| error[E0621]: explicit lifetime required in the type of `v` |
| --> $DIR/region-object-lifetime-in-coercion.rs:8:12 |
| | |
| LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> { |
| | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` |
| LL | let x: Box<dyn Foo + 'static> = Box::new(v); |
| | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required |
| |
| error[E0621]: explicit lifetime required in the type of `v` |
| --> $DIR/region-object-lifetime-in-coercion.rs:14:5 |
| | |
| LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> { |
| | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` |
| LL | Box::new(v) |
| | ^^^^^^^^^^^ lifetime `'static` required |
| |
| error[E0621]: explicit lifetime required in the type of `v` |
| --> $DIR/region-object-lifetime-in-coercion.rs:21:5 |
| | |
| LL | fn c(v: &[u8]) -> Box<dyn Foo> { |
| | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` |
| ... |
| LL | Box::new(v) |
| | ^^^^^^^^^^^ lifetime `'static` required |
| |
| error: lifetime may not live long enough |
| --> $DIR/region-object-lifetime-in-coercion.rs:26:5 |
| | |
| LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { |
| | -- -- lifetime `'b` defined here |
| | | |
| | lifetime `'a` defined here |
| LL | Box::new(v) |
| | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` |
| |
| error: aborting due to 4 previous errors |
| |
| For more information about this error, try `rustc --explain E0621`. |