fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.9 KiB74 linesraw
1error[E0310]: the parameter type `U` may not live long enough
2  --> $DIR/regions-close-object-into-object-4.rs:9:5
3   |
4LL |     Box::new(B(&*v)) as Box<dyn X>
5   |     ^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
6   |
7help: consider adding an explicit lifetime bound...
8   |
9LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
10   |              +++++++++
11
12error[E0310]: the parameter type `U` may not live long enough
13  --> $DIR/regions-close-object-into-object-4.rs:9:5
14   |
15LL |     Box::new(B(&*v)) as Box<dyn X>
16   |     ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
17   |
18help: consider adding an explicit lifetime bound...
19   |
20LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
21   |              +++++++++
22
23error[E0310]: the parameter type `U` may not live long enough
24  --> $DIR/regions-close-object-into-object-4.rs:9:5
25   |
26LL |     Box::new(B(&*v)) as Box<dyn X>
27   |     ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
28   |
29help: consider adding an explicit lifetime bound...
30   |
31LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
32   |              +++++++++
33
34error: lifetime may not live long enough
35  --> $DIR/regions-close-object-into-object-4.rs:9:5
36   |
37LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
38   |      -- lifetime `'a` defined here
39LL |     Box::new(B(&*v)) as Box<dyn X>
40   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
41   |
42help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v`
43   |
44LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'a> {
45   |                                                    ~~
46help: alternatively, add an explicit `'static` bound to this reference
47   |
48LL | fn i<'a, T, U>(v: Box<(dyn A<U> + 'static)>) -> Box<dyn X + 'static> {
49   |                   ~~~~~~~~~~~~~~~~~~~~~~~~~
50
51error[E0515]: cannot return value referencing local data `*v`
52  --> $DIR/regions-close-object-into-object-4.rs:9:5
53   |
54LL |     Box::new(B(&*v)) as Box<dyn X>
55   |     ^^^^^^^^^^^---^^^^^^^^^^^^^^^^
56   |     |          |
57   |     |          `*v` is borrowed here
58   |     returns a value referencing data owned by the current function
59
60error[E0310]: the parameter type `U` may not live long enough
61  --> $DIR/regions-close-object-into-object-4.rs:9:14
62   |
63LL |     Box::new(B(&*v)) as Box<dyn X>
64   |              ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
65   |
66help: consider adding an explicit lifetime bound...
67   |
68LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
69   |              +++++++++
70
71error: aborting due to 6 previous errors
72
73Some errors have detailed explanations: E0310, E0515.
74For more information about an error, try `rustc --explain E0310`.