]> git.proxmox.com Git - rustc.git/blame - src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / object-lifetime / object-lifetime-default-from-box-error.stderr
CommitLineData
923072b8 1error: lifetime may not live long enough
0731742a 2 --> $DIR/object-lifetime-default-from-box-error.rs:18:5
b7449926 3 |
dc9dc135 4LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
923072b8 5 | -- has type `&mut SomeStruct<'1>`
b7449926 6...
532ac7d7 7LL | ss.r
923072b8 8 | ^^^^ returning this value requires that `'1` must outlive `'static`
f9f354fc 9 |
f035d41b 10help: to declare that the trait object captures data from argument `ss`, you can add an explicit `'_` lifetime bound
f9f354fc
XL
11 |
12LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait + '_> {
94222f64 13 | ++++
b7449926 14
923072b8
FG
15error[E0507]: cannot move out of `ss.r` which is behind a mutable reference
16 --> $DIR/object-lifetime-default-from-box-error.rs:18:5
17 |
18LL | ss.r
19 | ^^^^ move occurs because `ss.r` has type `Box<dyn SomeTrait>`, which does not implement the `Copy` trait
20
b7449926 21error[E0621]: explicit lifetime required in the type of `ss`
923072b8 22 --> $DIR/object-lifetime-default-from-box-error.rs:33:5
b7449926 23 |
dc9dc135 24LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<dyn SomeTrait+'b>) {
b7449926
XL
25 | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>`
26...
532ac7d7 27LL | ss.r = b;
923072b8 28 | ^^^^ lifetime `'b` required
b7449926 29
923072b8 30error: aborting due to 3 previous errors
b7449926 31
923072b8
FG
32Some errors have detailed explanations: E0507, E0621.
33For more information about an error, try `rustc --explain E0507`.