]>
Commit | Line | Data |
---|---|---|
48663c56 XL |
1 | error[E0621]: explicit lifetime required in the type of `v` |
2 | --> $DIR/region-object-lifetime-in-coercion.rs:8:12 | |
3 | | | |
dc9dc135 | 4 | LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> { |
48663c56 | 5 | | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` |
dc9dc135 XL |
6 | LL | let x: Box<dyn Foo + 'static> = Box::new(v); |
7 | | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required | |
48663c56 XL |
8 | |
9 | error[E0621]: explicit lifetime required in the type of `v` | |
10 | --> $DIR/region-object-lifetime-in-coercion.rs:14:5 | |
11 | | | |
dc9dc135 | 12 | LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> { |
48663c56 XL |
13 | | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` |
14 | LL | Box::new(v) | |
15 | | ^^^^^^^^^^^ lifetime `'static` required | |
16 | ||
17 | error[E0621]: explicit lifetime required in the type of `v` | |
18 | --> $DIR/region-object-lifetime-in-coercion.rs:21:5 | |
19 | | | |
dc9dc135 | 20 | LL | fn c(v: &[u8]) -> Box<dyn Foo> { |
48663c56 XL |
21 | | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` |
22 | ... | |
23 | LL | Box::new(v) | |
24 | | ^^^^^^^^^^^ lifetime `'static` required | |
25 | ||
26 | error: lifetime may not live long enough | |
27 | --> $DIR/region-object-lifetime-in-coercion.rs:26:5 | |
28 | | | |
dc9dc135 | 29 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> { |
48663c56 XL |
30 | | -- -- lifetime `'b` defined here |
31 | | | | |
32 | | lifetime `'a` defined here | |
33 | LL | Box::new(v) | |
34 | | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b` | |
60c5eb7d XL |
35 | | |
36 | = help: consider adding the following bound: `'a: 'b` | |
48663c56 XL |
37 | |
38 | error: aborting due to 4 previous errors | |
39 | ||
40 | For more information about this error, try `rustc --explain E0621`. |