Skip to content

Commit fd78a2f

Browse files
committed
update tests with new error messages (mostly worse, I'm afraid)
1 parent 3ff3116 commit fd78a2f

21 files changed

+94
-86
lines changed

src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,19 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time
22
--> $DIR/mut-borrow-in-loop.rs:20:25
33
|
44
LL | (self.func)(arg) //~ ERROR cannot borrow
5-
| ------------^^^-
6-
| | |
7-
| | mutable borrow starts here in previous iteration of loop
8-
| borrow later used here
5+
| ^^^ mutable borrow starts here in previous iteration of loop
96

107
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
118
--> $DIR/mut-borrow-in-loop.rs:26:25
129
|
1310
LL | (self.func)(arg) //~ ERROR cannot borrow
14-
| ------------^^^-
15-
| | |
16-
| | mutable borrow starts here in previous iteration of loop
17-
| borrow later used here
11+
| ^^^ mutable borrow starts here in previous iteration of loop
1812

1913
error[E0499]: cannot borrow `*arg` as mutable more than once at a time
2014
--> $DIR/mut-borrow-in-loop.rs:33:25
2115
|
2216
LL | (self.func)(arg) //~ ERROR cannot borrow
23-
| ------------^^^-
24-
| | |
25-
| | mutable borrow starts here in previous iteration of loop
26-
| borrow later used here
17+
| ^^^ mutable borrow starts here in previous iteration of loop
2718

2819
error: aborting due to 3 previous errors
2920

src/test/ui/issue-46471.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ LL | &x
1717
...
1818
LL | }
1919
| - borrowed value only lives until here
20-
|
21-
= note: borrowed value must be valid for the static lifetime...
2220

2321
error: aborting due to 2 previous errors
2422

src/test/ui/issue-46472.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ LL | &mut 4
2121
...
2222
LL | }
2323
| - temporary value only lives until here
24-
|
25-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:1...
26-
--> $DIR/issue-46472.rs:13:1
27-
|
28-
LL | fn bar<'a>() -> &'a mut u32 {
29-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3024

3125
error: aborting due to 2 previous errors
3226

src/test/ui/issue-46983.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#![feature(nll)]
1212

1313
fn foo(x: &u32) -> &'static u32 {
14-
&*x
1514
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
15+
&*x
1616
}
1717

1818
fn main() {}

src/test/ui/issue-46983.stderr

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
error[E0621]: explicit lifetime required in the type of `x`
2-
--> $DIR/issue-46983.rs:14:5
2+
--> $DIR/issue-46983.rs:13:1
33
|
4-
LL | fn foo(x: &u32) -> &'static u32 {
5-
| - consider changing the type of `x` to `&'static u32`
6-
LL | &*x
7-
| ^^^ lifetime `'static` required
4+
LL | fn foo(x: &u32) -> &'static u32 {
5+
| ^ - consider changing the type of `x` to `&'static u32`
6+
| _|
7+
| |
8+
LL | | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
9+
LL | | &*x
10+
LL | | }
11+
| |_^ lifetime `'static` required
812

913
error: aborting due to previous error
1014

src/test/ui/nll/borrowed-universal-error-2.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ LL | &v
66
LL | //~^ ERROR `v` does not live long enough [E0597]
77
LL | }
88
| - borrowed value only lives until here
9-
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:1...
11-
--> $DIR/borrowed-universal-error-2.rs:14:1
12-
|
13-
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159

1610
error: aborting due to previous error
1711

src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
// compile-flags:-Zborrowck=mir -Zverbose
1717

1818
fn foo(x: &u32) -> &'static u32 {
19+
//~^ ERROR explicit lifetime required in the type of `x`
1920
&*x
2021
//~^ WARN not reporting region error due to nll
21-
//~| ERROR explicit lifetime required in the type of `x`
2222
}
2323

2424
fn main() { }

src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
warning: not reporting region error due to nll
2-
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
2+
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:20:5
33
|
44
LL | &*x
55
| ^^^
66

77
error[E0621]: explicit lifetime required in the type of `x`
8-
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
8+
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:18:1
99
|
10-
LL | fn foo(x: &u32) -> &'static u32 {
11-
| - consider changing the type of `x` to `&ReStatic u32`
12-
LL | &*x
13-
| ^^^ lifetime `ReStatic` required
10+
LL | fn foo(x: &u32) -> &'static u32 {
11+
| ^ - consider changing the type of `x` to `&ReStatic u32`
12+
| _|
13+
| |
14+
LL | | //~^ ERROR explicit lifetime required in the type of `x`
15+
LL | | &*x
16+
LL | | //~^ WARN not reporting region error due to nll
17+
LL | | }
18+
| |_^ lifetime `ReStatic` required
1419

1520
error: aborting due to previous error
1621

src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
// compile-flags:-Zborrowck=mir -Zverbose
1717

1818
fn foo<'a>(x: &'a u32) -> &'static u32 {
19+
//~^ ERROR does not outlive free region
1920
&*x
2021
//~^ WARN not reporting region error due to nll
21-
//~| ERROR does not outlive free region
2222
}
2323

2424
fn main() { }
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
warning: not reporting region error due to nll
2-
--> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
2+
--> $DIR/region-lbr-named-does-not-outlive-static.rs:20:5
33
|
44
LL | &*x
55
| ^^^
66

77
error: free region `ReFree(DefId(0/0:3 ~ region_lbr_named_does_not_outlive_static[317d]::foo[0]), BrNamed(crate0:DefIndex(1:9), 'a))` does not outlive free region `ReStatic`
8-
--> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
8+
--> $DIR/region-lbr-named-does-not-outlive-static.rs:18:1
99
|
10-
LL | &*x
11-
| ^^^
10+
LL | / fn foo<'a>(x: &'a u32) -> &'static u32 {
11+
LL | | //~^ ERROR does not outlive free region
12+
LL | | &*x
13+
LL | | //~^ WARN not reporting region error due to nll
14+
LL | | }
15+
| |_^
1216

1317
error: aborting due to previous error
1418

0 commit comments

Comments
 (0)