@@ -16,67 +16,22 @@ LL | return x; //~ ERROR unsatisfied lifetime constraints
1616 | ^ returning this value requires that `'1` must outlive `'static`
1717
1818error: unsatisfied lifetime constraints
19- --> $DIR/closure-substs.rs:25:16
20- |
21- LL | |x: &i32| -> &'static i32 {
22- | - - return type of closure is &'2 i32
23- | |
24- | let's call the lifetime of this reference `'1`
25- LL | return x; //~ ERROR unsatisfied lifetime constraints
26- | ^ returning this value requires that `'1` must outlive `'2`
27-
28- error: unsatisfied lifetime constraints
29- --> $DIR/closure-substs.rs:25:16
30- |
31- LL | |x: &i32| -> &'static i32 {
32- | -------------------------
33- | | |
34- | | let's call the lifetime of this reference `'1`
35- | lifetime `'2` represents this closure's body
36- LL | return x; //~ ERROR unsatisfied lifetime constraints
37- | ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
38- |
39- = note: closure implements `Fn`, so references to captured variables can't escape the closure
40-
41- error: unsatisfied lifetime constraints
42- --> $DIR/closure-substs.rs:34:9
19+ --> $DIR/closure-substs.rs:32:9
4320 |
4421LL | fn bar<'a>() {
4522 | -- lifetime `'a` defined here
4623...
4724LL | b(x); //~ ERROR unsatisfied lifetime constraints
4825 | ^^^^ argument requires that `'a` must outlive `'static`
4926
50- error: borrowed data escapes outside of closure
51- --> $DIR/closure-substs.rs:41 :9
27+ error[E0521] : borrowed data escapes outside of closure
28+ --> $DIR/closure-substs.rs:39 :9
5229 |
5330LL | |x: &i32, b: fn(&'static i32)| {
5431 | - `x` is a reference that is only valid in the closure body
55- LL | b(x); //~ ERROR
56- | ^^^^ `x` escapes the closure body here
57-
58- error: borrowed data escapes outside of closure
59- --> $DIR/closure-substs.rs:41:9
60- |
61- LL | |x: &i32, b: fn(&'static i32)| {
62- | - - `b` is declared here, outside of the closure body
63- | |
64- | `x` is a reference that is only valid in the closure body
65- LL | b(x); //~ ERROR
32+ LL | b(x); //~ ERROR borrowed data escapes outside of closure
6633 | ^^^^ `x` escapes the closure body here
6734
68- error: unsatisfied lifetime constraints
69- --> $DIR/closure-substs.rs:41:9
70- |
71- LL | |x: &i32, b: fn(&'static i32)| {
72- | ------------------------------
73- | | |
74- | | let's call the lifetime of this reference `'1`
75- | lifetime `'2` represents this closure's body
76- LL | b(x); //~ ERROR
77- | ^^^^ argument requires that `'1` must outlive `'2`
78- |
79- = note: closure implements `Fn`, so references to captured variables can't escape the closure
80-
81- error: aborting due to 8 previous errors
35+ error: aborting due to 4 previous errors
8236
37+ For more information about this error, try `rustc --explain E0521`.
0 commit comments