]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/region-object-lifetime-in-coercion.stderr
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / regions / region-object-lifetime-in-coercion.stderr
CommitLineData
b7449926 1error[E0621]: explicit lifetime required in the type of `v`
dc9dc135 2 --> $DIR/region-object-lifetime-in-coercion.rs:8:37
b7449926 3 |
dc9dc135 4LL | fn a(v: &[u8]) -> Box<dyn Foo + 'static> {
b7449926 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
b7449926
XL
8
9error[E0621]: explicit lifetime required in the type of `v`
0731742a 10 --> $DIR/region-object-lifetime-in-coercion.rs:14:5
b7449926 11 |
dc9dc135 12LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
b7449926
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`
0731742a 18 --> $DIR/region-object-lifetime-in-coercion.rs:21:5
b7449926 19 |
dc9dc135 20LL | fn c(v: &[u8]) -> Box<dyn Foo> {
b7449926
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[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
0731742a 27 --> $DIR/region-object-lifetime-in-coercion.rs:26:14
b7449926
XL
28 |
29LL | Box::new(v)
30 | ^
31 |
e74abb32 32note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 25:6...
0731742a 33 --> $DIR/region-object-lifetime-in-coercion.rs:25:6
b7449926 34 |
dc9dc135 35LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
b7449926 36 | ^^
60c5eb7d
XL
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]`
e74abb32 44note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 25:9...
0731742a 45 --> $DIR/region-object-lifetime-in-coercion.rs:25:9
b7449926 46 |
dc9dc135 47LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
b7449926 48 | ^^
60c5eb7d
XL
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>`
b7449926
XL
56
57error: aborting due to 4 previous errors
58
e74abb32
XL
59Some errors have detailed explanations: E0495, E0621.
60For more information about an error, try `rustc --explain E0495`.