@@ -16,67 +16,22 @@ LL | return x; //~ ERROR unsatisfied lifetime constraints
16
16
| ^ returning this value requires that `'1` must outlive `'static`
17
17
18
18
error: 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
43
20
|
44
21
LL | fn bar<'a>() {
45
22
| -- lifetime `'a` defined here
46
23
...
47
24
LL | b(x); //~ ERROR unsatisfied lifetime constraints
48
25
| ^^^^ argument requires that `'a` must outlive `'static`
49
26
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
52
29
|
53
30
LL | |x: &i32, b: fn(&'static i32)| {
54
31
| - `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
66
33
| ^^^^ `x` escapes the closure body here
67
34
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
82
36
37
+ For more information about this error, try `rustc --explain E0521`.
0 commit comments