]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / regions / region-object-lifetime-in-coercion.nll.stderr
CommitLineData
48663c56
XL
1error[E0621]: explicit lifetime required in the type of `v`
2 --> $DIR/region-object-lifetime-in-coercion.rs:8:12
3 |
dc9dc135 4LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> {
48663c56 5 | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
dc9dc135
XL
6LL | let x: Box<dyn Foo + 'static> = Box::new(v);
7 | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
48663c56
XL
8
9error[E0621]: explicit lifetime required in the type of `v`
10 --> $DIR/region-object-lifetime-in-coercion.rs:14:5
11 |
dc9dc135 12LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
48663c56
XL
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 |
dc9dc135 20LL | fn c(v: &[u8]) -> Box<dyn Foo> {
48663c56
XL
21 | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
22...
23LL | Box::new(v)
24 | ^^^^^^^^^^^ lifetime `'static` required
25
26error: lifetime may not live long enough
27 --> $DIR/region-object-lifetime-in-coercion.rs:26:5
28 |
dc9dc135 29LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
48663c56
XL
30 | -- -- lifetime `'b` defined here
31 | |
32 | lifetime `'a` defined here
33LL | 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
38error: aborting due to 4 previous errors
39
40For more information about this error, try `rustc --explain E0621`.