fork/rust
git clone https://git.julia.blue/fork/rust
b8cedc00407
1.42.0
1error[E0621]: explicit lifetime required in the type of `v` 2 --> $DIR/region-object-lifetime-in-coercion.rs:8:37 3 | 4LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> { 5 | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` 6LL | let x: Box<dyn Foo + 'static> = Box::new(v); 7 | ^^^^^^^^^^^ lifetime `'static` required 8 9error[E0621]: explicit lifetime required in the type of `v` 10 --> $DIR/region-object-lifetime-in-coercion.rs:14:5 11 | 12LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> { 13 | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` 14LL | Box::new(v) 15 | ^^^^^^^^^^^ lifetime `'static` required 16 17error[E0621]: explicit lifetime required in the type of `v` 18 --> $DIR/region-object-lifetime-in-coercion.rs:21:5 19 | 20LL | fn c(v: &[u8]) -> Box<dyn Foo> { 21 | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` 22... 23LL | Box::new(v) 24 | ^^^^^^^^^^^ lifetime `'static` required 25 26error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements 27 --> $DIR/region-object-lifetime-in-coercion.rs:26:14 28 | 29LL | Box::new(v) 30 | ^ 31 | 32note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 25:6... 33 --> $DIR/region-object-lifetime-in-coercion.rs:25:6 34 | 35LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { 36 | ^^ 37note: ...so that the expression is assignable 38 --> $DIR/region-object-lifetime-in-coercion.rs:26:14 39 | 40LL | Box::new(v) 41 | ^ 42 = note: expected `&[u8]` 43 found `&'a [u8]` 44note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9... 45 --> $DIR/region-object-lifetime-in-coercion.rs:25:9 46 | 47LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { 48 | ^^ 49note: ...so that the expression is assignable 50 --> $DIR/region-object-lifetime-in-coercion.rs:26:5 51 | 52LL | Box::new(v) 53 | ^^^^^^^^^^^ 54 = note: expected `std::boxed::Box<(dyn Foo + 'b)>` 55 found `std::boxed::Box<dyn Foo>` 56 57error: aborting due to 4 previous errors 58 59Some errors have detailed explanations: E0495, E0621. 60For more information about an error, try `rustc --explain E0495`.