]>
Commit | Line | Data |
---|---|---|
923072b8 FG |
1 | error[E0521]: borrowed data escapes outside of function |
2 | --> $DIR/lifetime-bound-will-change-warning.rs:34:5 | |
b7449926 | 3 | | |
dc9dc135 | 4 | LL | fn test2<'a>(x: &'a Box<dyn Fn() + 'a>) { |
923072b8 FG |
5 | | -- - `x` is a reference that is only valid in the function body |
6 | | | | |
7 | | lifetime `'a` defined here | |
8 | LL | // but ref_obj will not, so warn. | |
9 | LL | ref_obj(x) | |
10 | | ^^^^^^^^^^ | |
11 | | | | |
12 | | `x` escapes the function body here | |
13 | | argument requires that `'a` must outlive `'static` | |
b7449926 | 14 | |
923072b8 FG |
15 | error[E0521]: borrowed data escapes outside of function |
16 | --> $DIR/lifetime-bound-will-change-warning.rs:40:5 | |
b7449926 | 17 | | |
dc9dc135 | 18 | LL | fn test2cc<'a>(x: &'a Box<dyn Fn() + 'a>) { |
923072b8 FG |
19 | | -- - `x` is a reference that is only valid in the function body |
20 | | | | |
21 | | lifetime `'a` defined here | |
22 | LL | // same as test2, but cross crate | |
23 | LL | lib::ref_obj(x) | |
24 | | ^^^^^^^^^^^^^^^ | |
25 | | | | |
26 | | `x` escapes the function body here | |
27 | | argument requires that `'a` must outlive `'static` | |
b7449926 XL |
28 | |
29 | error: aborting due to 2 previous errors | |
30 | ||
923072b8 | 31 | For more information about this error, try `rustc --explain E0521`. |