fork/rust
git clone https://git.julia.blue/fork/rust
5e1a799842b
1.41.0
1error: lifetime may not live long enough 2 --> $DIR/closure-substs.rs:8:16 3 | 4LL | fn foo<'a>() { 5 | -- lifetime `'a` defined here 6... 7LL | return x; 8 | ^ returning this value requires that `'a` must outlive `'static` 9 | 10 = help: consider replacing `'a` with `'static` 11 12error: lifetime may not live long enough 13 --> $DIR/closure-substs.rs:15:16 14 | 15LL | |x: &i32| -> &'static i32 { 16 | - let's call the lifetime of this reference `'1` 17LL | return x; 18 | ^ returning this value requires that `'1` must outlive `'static` 19 20error: lifetime may not live long enough 21 --> $DIR/closure-substs.rs:15:16 22 | 23LL | |x: &i32| -> &'static i32 { 24 | - ------------ return type of closure is &'2 i32 25 | | 26 | let's call the lifetime of this reference `'1` 27LL | return x; 28 | ^ returning this value requires that `'1` must outlive `'2` 29 30error: lifetime may not live long enough 31 --> $DIR/closure-substs.rs:22:9 32 | 33LL | fn bar<'a>() { 34 | -- lifetime `'a` defined here 35... 36LL | b(x); 37 | ^^^^ argument requires that `'a` must outlive `'static` 38 | 39 = help: consider replacing `'a` with `'static` 40 41error[E0521]: borrowed data escapes outside of closure 42 --> $DIR/closure-substs.rs:29:9 43 | 44LL | |x: &i32, b: fn(&'static i32)| { 45 | - `x` is a reference that is only valid in the closure body 46LL | b(x); 47 | ^^^^ `x` escapes the closure body here 48 49error[E0521]: borrowed data escapes outside of closure 50 --> $DIR/closure-substs.rs:29:9 51 | 52LL | |x: &i32, b: fn(&'static i32)| { 53 | - - `b` is declared here, outside of the closure body 54 | | 55 | `x` is a reference that is only valid in the closure body 56LL | b(x); 57 | ^^^^ `x` escapes the closure body here 58 59error: aborting due to 6 previous errors 60