fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.2 KiB31 linesraw
1error[E0623]: lifetime mismatch
2  --> $DIR/object-lifetime-default-mybox.rs:27:5
3   |
4LL | fn load1<'a,'b>(a: &'a MyBox<dyn SomeTrait>,
5   |                    ------------------------ this parameter and the return type are declared with different lifetimes...
6LL |                 b: &'b MyBox<dyn SomeTrait>)
7LL |                 -> &'b MyBox<dyn SomeTrait>
8   |                    ------------------------
9LL | {
10LL |     a
11   |     ^ ...but data from `a` is returned here
12
13error[E0308]: mismatched types
14  --> $DIR/object-lifetime-default-mybox.rs:31:11
15   |
16LL |     load0(ss)
17   |           ^^ lifetime mismatch
18   |
19   = note: expected reference `&MyBox<(dyn SomeTrait + 'static)>`
20              found reference `&MyBox<(dyn SomeTrait + 'a)>`
21note: the lifetime `'a` as defined on the function body at 30:10...
22  --> $DIR/object-lifetime-default-mybox.rs:30:10
23   |
24LL | fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> {
25   |          ^^
26   = note: ...does not necessarily outlive the static lifetime
27
28error: aborting due to 2 previous errors
29
30Some errors have detailed explanations: E0308, E0623.
31For more information about an error, try `rustc --explain E0308`.