/
region-object-lifetime-in-coercion.nll.stderr
38 lines (33 loc) · 1.43 KB
/
region-object-lifetime-in-coercion.nll.stderr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
error[E0621]: explicit lifetime required in the type of `v`
--> $DIR/region-object-lifetime-in-coercion.rs:18:12
|
LL | fn a(v: &[u8]) -> Box<Foo + 'static> {
| ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
LL | let x: Box<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:24:5
|
LL | fn b(v: &[u8]) -> Box<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:31:5
|
LL | fn c(v: &[u8]) -> Box<Foo> {
| ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
...
LL | Box::new(v)
| ^^^^^^^^^^^ lifetime `'static` required
error: unsatisfied lifetime constraints
--> $DIR/region-object-lifetime-in-coercion.rs:36:5
|
LL | fn d<'a,'b>(v: &'a [u8]) -> Box<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`.