]> git.lizzy.rs Git - rust.git/blob - tests/ui/object-lifetime/object-lifetime-default-mybox.stderr
Rollup merge of #106664 - chenyukang:yukang/fix-106597-remove-lseek, r=cuviper
[rust.git] / tests / ui / object-lifetime / object-lifetime-default-mybox.stderr
1 error: lifetime may not live long enough
2   --> $DIR/object-lifetime-default-mybox.rs:27:5
3    |
4 LL | fn load1<'a,'b>(a: &'a MyBox<dyn SomeTrait>,
5    |          -- -- lifetime `'b` defined here
6    |          |
7    |          lifetime `'a` defined here
8 ...
9 LL |     a
10    |     ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
11    |
12    = help: consider adding the following bound: `'a: 'b`
13
14 error[E0521]: borrowed data escapes outside of function
15   --> $DIR/object-lifetime-default-mybox.rs:32:5
16    |
17 LL | fn load2<'a>(ss: &MyBox<dyn SomeTrait + 'a>) -> MyBox<dyn SomeTrait + 'a> {
18    |          --  -- `ss` is a reference that is only valid in the function body
19    |          |
20    |          lifetime `'a` defined here
21 LL |     load0(ss)
22    |     ^^^^^^^^^
23    |     |
24    |     `ss` escapes the function body here
25    |     argument requires that `'a` must outlive `'static`
26
27 error: aborting due to 2 previous errors
28
29 For more information about this error, try `rustc --explain E0521`.