]>
Commit | Line | Data |
---|---|---|
9fa01778 | 1 | error: lifetime may not live long enough |
0731742a | 2 | --> $DIR/closure-substs.rs:8:16 |
0bf4aa26 XL |
3 | | |
4 | LL | fn foo<'a>() { | |
5 | | -- lifetime `'a` defined here | |
6 | ... | |
532ac7d7 | 7 | LL | return x; |
0bf4aa26 | 8 | | ^ returning this value requires that `'a` must outlive `'static` |
60c5eb7d XL |
9 | | |
10 | = help: consider replacing `'a` with `'static` | |
0bf4aa26 | 11 | |
9fa01778 | 12 | error: lifetime may not live long enough |
0731742a | 13 | --> $DIR/closure-substs.rs:15:16 |
0bf4aa26 XL |
14 | | |
15 | LL | |x: &i32| -> &'static i32 { | |
16 | | - let's call the lifetime of this reference `'1` | |
532ac7d7 | 17 | LL | return x; |
0bf4aa26 XL |
18 | | ^ returning this value requires that `'1` must outlive `'static` |
19 | ||
9fa01778 | 20 | error: lifetime may not live long enough |
0731742a | 21 | --> $DIR/closure-substs.rs:22:9 |
0bf4aa26 XL |
22 | | |
23 | LL | fn bar<'a>() { | |
24 | | -- lifetime `'a` defined here | |
25 | ... | |
532ac7d7 | 26 | LL | b(x); |
0bf4aa26 | 27 | | ^^^^ argument requires that `'a` must outlive `'static` |
60c5eb7d XL |
28 | | |
29 | = help: consider replacing `'a` with `'static` | |
0bf4aa26 XL |
30 | |
31 | error[E0521]: borrowed data escapes outside of closure | |
0731742a | 32 | --> $DIR/closure-substs.rs:29:9 |
0bf4aa26 XL |
33 | | |
34 | LL | |x: &i32, b: fn(&'static i32)| { | |
35 | | - `x` is a reference that is only valid in the closure body | |
532ac7d7 | 36 | LL | b(x); |
0bf4aa26 XL |
37 | | ^^^^ `x` escapes the closure body here |
38 | ||
39 | error: aborting due to 4 previous errors | |
40 |