]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-close-object-into-object-2.stderr
Auto merge of #74662 - Manishearth:rollup-jdt7t71, r=Manishearth
[rust.git] / src / test / ui / regions / regions-close-object-into-object-2.stderr
1 error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
2   --> $DIR/regions-close-object-into-object-2.rs:10:11
3    |
4 LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> {
5    |                         ------------------ this data with lifetime `'a`...
6 LL |     box B(&*v) as Box<dyn X>
7    |           ^^^ ...is captured here, requiring it to live as long as `'static`
8    |
9 help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v`
10    |
11 LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'a> {
12    |                                                            ^^
13 help: alternatively, add an explicit `'static` bound to this reference
14    |
15 LL | fn g<'a, T: 'static>(v: std::boxed::Box<(dyn A<T> + 'static)>) -> Box<dyn X + 'static> {
16    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17
18 error: aborting due to previous error
19
20 For more information about this error, try `rustc --explain E0759`.