fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

1.43.1
1.5 KiB40 linesraw
1error[E0621]: explicit lifetime required in the type of `v`
2  --> $DIR/region-object-lifetime-in-coercion.rs:8:12
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: lifetime may not live long enough
27  --> $DIR/region-object-lifetime-in-coercion.rs:26:5
28   |
29LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
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`
35   |
36   = help: consider adding the following bound: `'a: 'b`
37
38error: aborting due to 4 previous errors
39
40For more information about this error, try `rustc --explain E0621`.