fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.3 KiB39 linesraw
1error[E0310]: the parameter type `U` may not live long enough
2  --> $DIR/regions-close-object-into-object-4.rs:10:5
3   |
4LL |     box B(&*v) as Box<dyn X>
5   |     ^^^^^^^^^^
6   |
7   = help: consider adding an explicit lifetime bound `U: 'static`...
8
9error: lifetime may not live long enough
10  --> $DIR/regions-close-object-into-object-4.rs:10:5
11   |
12LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
13   |      -- lifetime `'a` defined here
14LL |     box B(&*v) as Box<dyn X>
15   |     ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
16   |
17   = help: consider replacing `'a` with `'static`
18
19error[E0515]: cannot return value referencing local data `*v`
20  --> $DIR/regions-close-object-into-object-4.rs:10:5
21   |
22LL |     box B(&*v) as Box<dyn X>
23   |     ^^^^^^---^^^^^^^^^^^^^^^
24   |     |     |
25   |     |     `*v` is borrowed here
26   |     returns a value referencing data owned by the current function
27
28error[E0310]: the parameter type `U` may not live long enough
29  --> $DIR/regions-close-object-into-object-4.rs:10:9
30   |
31LL |     box B(&*v) as Box<dyn X>
32   |         ^^^^^^
33   |
34   = help: consider adding an explicit lifetime bound `U: 'static`...
35
36error: aborting due to 4 previous errors
37
38Some errors have detailed explanations: E0310, E0515.
39For more information about an error, try `rustc --explain E0310`.