fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.1 KiB28 linesraw
1error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
2  --> $DIR/regions-close-object-into-object-2.rs:10:11
3   |
4LL |     box B(&*v) as Box<dyn X>
5   |           ^^^
6   |
7note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 9:6...
8  --> $DIR/regions-close-object-into-object-2.rs:9:6
9   |
10LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
11   |      ^^
12note: ...so that the type `(dyn A<T> + 'a)` is not borrowed for too long
13  --> $DIR/regions-close-object-into-object-2.rs:10:11
14   |
15LL |     box B(&*v) as Box<dyn X>
16   |           ^^^
17   = note: but, the lifetime must be valid for the static lifetime...
18note: ...so that the expression is assignable
19  --> $DIR/regions-close-object-into-object-2.rs:10:5
20   |
21LL |     box B(&*v) as Box<dyn X>
22   |     ^^^^^^^^^^^^^^^^^^^^^^^^
23   = note: expected  `std::boxed::Box<(dyn X + 'static)>`
24              found  `std::boxed::Box<dyn X>`
25
26error: aborting due to previous error
27
28For more information about this error, try `rustc --explain E0495`.