fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
1.3 KiB37 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
17error[E0515]: cannot return value referencing local data `*v`
18  --> $DIR/regions-close-object-into-object-4.rs:10:5
19   |
20LL |     box B(&*v) as Box<dyn X>
21   |     ^^^^^^---^^^^^^^^^^^^^^^
22   |     |     |
23   |     |     `*v` is borrowed here
24   |     returns a value referencing data owned by the current function
25
26error[E0310]: the parameter type `U` may not live long enough
27  --> $DIR/regions-close-object-into-object-4.rs:10:9
28   |
29LL |     box B(&*v) as Box<dyn X>
30   |         ^^^^^^
31   |
32   = help: consider adding an explicit lifetime bound `U: 'static`...
33
34error: aborting due to 4 previous errors
35
36Some errors have detailed explanations: E0310, E0515.
37For more information about an error, try `rustc --explain E0310`.