Skip to content

Commit 720716f

Browse files
committed
bless polonius output due to lacking the 'static special-casing
1 parent 6956408 commit 720716f

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
error[E0521]: borrowed data escapes outside of closure
2+
--> $DIR/expect-region-supply-region.rs:18:9
3+
|
4+
LL | let mut f: Option<&u32> = None;
5+
| ----- `f` is declared here, outside of the closure body
6+
LL | closure_expecting_bound(|x| {
7+
| - `x` is a reference that is only valid in the closure body
8+
LL | f = Some(x);
9+
| ^^^^^^^^^^^ `x` escapes the closure body here
10+
11+
error[E0521]: borrowed data escapes outside of closure
12+
--> $DIR/expect-region-supply-region.rs:28:9
13+
|
14+
LL | let mut f: Option<&u32> = None;
15+
| ----- `f` is declared here, outside of the closure body
16+
LL | closure_expecting_bound(|x: &u32| {
17+
| - `x` is a reference that is only valid in the closure body
18+
LL | f = Some(x);
19+
| ^^^^^^^^^^^ `x` escapes the closure body here
20+
21+
error: lifetime may not live long enough
22+
--> $DIR/expect-region-supply-region.rs:37:30
23+
|
24+
LL | fn expect_bound_supply_named<'x>() {
25+
| -- lifetime `'x` defined here
26+
...
27+
LL | closure_expecting_bound(|x: &'x u32| {
28+
| ^ - let's call the lifetime of this reference `'1`
29+
| |
30+
| requires that `'1` must outlive `'x`
31+
32+
error[E0521]: borrowed data escapes outside of closure
33+
--> $DIR/expect-region-supply-region.rs:42:9
34+
|
35+
LL | let mut f: Option<&u32> = None;
36+
| ----- `f` is declared here, outside of the closure body
37+
...
38+
LL | closure_expecting_bound(|x: &'x u32| {
39+
| - `x` is a reference that is only valid in the closure body
40+
...
41+
LL | f = Some(x);
42+
| ^^^^^^^^^^^ `x` escapes the closure body here
43+
44+
error: lifetime may not live long enough
45+
--> $DIR/expect-region-supply-region.rs:37:30
46+
|
47+
LL | fn expect_bound_supply_named<'x>() {
48+
| -- lifetime `'x` defined here
49+
...
50+
LL | closure_expecting_bound(|x: &'x u32| {
51+
| ^ requires that `'x` must outlive `'static`
52+
|
53+
= help: consider replacing `'x` with `'static`
54+
55+
error: aborting due to 5 previous errors
56+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/error-handling.rs:13:56
3+
|
4+
LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
5+
| -- -- lifetime `'b` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'b`
6+
| |
7+
| lifetime `'a` defined here
8+
|
9+
= help: consider adding the following bound: `'a: 'b`
10+
11+
error: aborting due to previous error
12+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/closure-substs.rs:8:16
3+
|
4+
LL | fn foo<'a>() {
5+
| -- lifetime `'a` defined here
6+
...
7+
LL | return x;
8+
| ^ returning this value requires that `'a` must outlive `'static`
9+
|
10+
= help: consider replacing `'a` with `'static`
11+
12+
error: lifetime may not live long enough
13+
--> $DIR/closure-substs.rs:15:16
14+
|
15+
LL | |x: &i32| -> &'static i32 {
16+
| - let's call the lifetime of this reference `'1`
17+
LL | return x;
18+
| ^ returning this value requires that `'1` must outlive `'static`
19+
20+
error: lifetime may not live long enough
21+
--> $DIR/closure-substs.rs:15:16
22+
|
23+
LL | |x: &i32| -> &'static i32 {
24+
| - ------------ return type of closure is &'2 i32
25+
| |
26+
| let's call the lifetime of this reference `'1`
27+
LL | return x;
28+
| ^ returning this value requires that `'1` must outlive `'2`
29+
30+
error: lifetime may not live long enough
31+
--> $DIR/closure-substs.rs:22:9
32+
|
33+
LL | fn bar<'a>() {
34+
| -- lifetime `'a` defined here
35+
...
36+
LL | b(x);
37+
| ^^^^ argument requires that `'a` must outlive `'static`
38+
|
39+
= help: consider replacing `'a` with `'static`
40+
41+
error[E0521]: borrowed data escapes outside of closure
42+
--> $DIR/closure-substs.rs:29:9
43+
|
44+
LL | |x: &i32, b: fn(&'static i32)| {
45+
| - `x` is a reference that is only valid in the closure body
46+
LL | b(x);
47+
| ^^^^ `x` escapes the closure body here
48+
49+
error[E0521]: borrowed data escapes outside of closure
50+
--> $DIR/closure-substs.rs:29:9
51+
|
52+
LL | |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
56+
LL | b(x);
57+
| ^^^^ `x` escapes the closure body here
58+
59+
error: aborting due to 6 previous errors
60+

0 commit comments

Comments
 (0)