fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.3 KiB33 linesraw
1error: lifetime may not live long enough
2  --> $DIR/object-lifetime-default-from-box-error.rs:18:5
3   |
4LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
5   |         -- has type `&mut SomeStruct<'1>`
6...
7LL |     ss.r
8   |     ^^^^ returning this value requires that `'1` must outlive `'static`
9   |
10help: to declare that the trait object captures data from argument `ss`, you can add an explicit `'_` lifetime bound
11   |
12LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait + '_> {
13   |                                                   ++++
14
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
21error[E0621]: explicit lifetime required in the type of `ss`
22  --> $DIR/object-lifetime-default-from-box-error.rs:33:5
23   |
24LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<dyn SomeTrait+'b>) {
25   |                   --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>`
26...
27LL |     ss.r = b;
28   |     ^^^^ lifetime `'b` required
29
30error: aborting due to 3 previous errors
31
32Some errors have detailed explanations: E0507, E0621.
33For more information about an error, try `rustc --explain E0507`.