]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-close-object-into-object-4.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / regions / regions-close-object-into-object-4.stderr
1 error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
2   --> $DIR/regions-close-object-into-object-4.rs:10:11
3    |
4 LL |     box B(&*v) as Box<X> //~ ERROR cannot infer
5    |           ^^^
6    |
7 note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6...
8   --> $DIR/regions-close-object-into-object-4.rs:9:6
9    |
10 LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
11    |      ^^
12 note: ...so that the type `(dyn A<U> + 'a)` is not borrowed for too long
13   --> $DIR/regions-close-object-into-object-4.rs:10:11
14    |
15 LL |     box B(&*v) as Box<X> //~ ERROR cannot infer
16    |           ^^^
17    = note: but, the lifetime must be valid for the static lifetime...
18    = note: ...so that the expression is assignable:
19            expected std::boxed::Box<(dyn X + 'static)>
20               found std::boxed::Box<dyn X>
21
22 error: aborting due to previous error
23
24 For more information about this error, try `rustc --explain E0495`.