]> git.lizzy.rs Git - rust.git/blob - src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr
Auto merge of #54581 - petrochenkov:cfgattr, r=alexcrichton
[rust.git] / src / test / ui / object-lifetime / object-lifetime-default-mybox.stderr
1 error[E0623]: lifetime mismatch
2   --> $DIR/object-lifetime-default-mybox.rs:37:5
3    |
4 LL | fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
5    |                    -------------------- this parameter and the return type are declared with different lifetimes...
6 LL |                 b: &'b MyBox<SomeTrait>)
7 LL |                 -> &'b MyBox<SomeTrait>
8    |                    --------------------
9 LL | {
10 LL |     a //~ ERROR lifetime mismatch
11    |     ^ ...but data from `a` is returned here
12
13 error[E0308]: mismatched types
14   --> $DIR/object-lifetime-default-mybox.rs:41:11
15    |
16 LL |     load0(ss) //~ ERROR mismatched types
17    |           ^^ lifetime mismatch
18    |
19    = note: expected type `&MyBox<(dyn SomeTrait + 'static)>`
20               found type `&MyBox<(dyn SomeTrait + 'a)>`
21 note: the lifetime 'a as defined on the function body at 40:10...
22   --> $DIR/object-lifetime-default-mybox.rs:40:10
23    |
24 LL | fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> {
25    |          ^^
26    = note: ...does not necessarily outlive the static lifetime
27
28 error: aborting due to 2 previous errors
29
30 Some errors occurred: E0308, E0623.
31 For more information about an error, try `rustc --explain E0308`.