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