fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: lifetime may not live long enough 2 --> $DIR/regions-close-object-into-object-2.rs:9:5 3 | 4LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> { 5 | -- lifetime `'a` defined here 6LL | Box::new(B(&*v)) as Box<dyn X> 7 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` 8 | 9help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` 10 | 11LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'a> { 12 | ~~ 13help: alternatively, add an explicit `'static` bound to this reference 14 | 15LL | fn g<'a, T: 'static>(v: Box<(dyn A<T> + 'static)>) -> Box<dyn X + 'static> { 16 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 17 18error[E0515]: cannot return value referencing local data `*v` 19 --> $DIR/regions-close-object-into-object-2.rs:9:5 20 | 21LL | Box::new(B(&*v)) as Box<dyn X> 22 | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ 23 | | | 24 | | `*v` is borrowed here 25 | returns a value referencing data owned by the current function 26 27error: aborting due to 2 previous errors 28 29For more information about this error, try `rustc --explain E0515`.