fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
1.1 KiB28 linesraw
1error[E0621]: explicit lifetime required in the type of `ss`
2  --> $DIR/object-lifetime-default-from-box-error.rs:18:5
3   |
4LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
5   |             --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>`
6...
7LL |     ss.r
8   |     ^^^^ lifetime `'static` required
9
10error[E0507]: cannot move out of `ss.r` which is behind a mutable reference
11  --> $DIR/object-lifetime-default-from-box-error.rs:18:5
12   |
13LL |     ss.r
14   |     ^^^^ move occurs because `ss.r` has type `std::boxed::Box<dyn SomeTrait>`, which does not implement the `Copy` trait
15
16error[E0621]: explicit lifetime required in the type of `ss`
17  --> $DIR/object-lifetime-default-from-box-error.rs:31:5
18   |
19LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<dyn SomeTrait+'b>) {
20   |                   --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>`
21...
22LL |     ss.r = b;
23   |     ^^^^ lifetime `'b` required
24
25error: aborting due to 3 previous errors
26
27Some errors have detailed explanations: E0507, E0621.
28For more information about an error, try `rustc --explain E0507`.