Skip to content

Commit 35971cc

Browse files
committed
Update the existing UI tests to reflect diagnostic changes in NLL.
1 parent 0d9998c commit 35971cc

File tree

6 files changed

+38
-5
lines changed

6 files changed

+38
-5
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0384]: cannot assign twice to immutable variable `x`
2+
--> $DIR/asm-out-assign-imm.rs:33:9
3+
|
4+
LL | let x: isize;
5+
| - consider changing this to `mut x`
6+
LL | x = 1;
7+
| ----- first assignment to `x`
8+
...
9+
LL | asm!("mov $1, $0" : "=r"(x) : "r"(5));
10+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0384`.

src/test/ui/borrowck/immutable-arg.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0384]: cannot assign to immutable argument `_x` (Mir)
1010
--> $DIR/immutable-arg.rs:14:5
1111
|
1212
LL | fn foo(_x: u32) {
13-
| -- argument not declared as `mut`
13+
| -- consider changing this to `mut _x`
1414
LL | _x = 4;
1515
| ^^^^^^ cannot assign to immutable argument
1616

src/test/ui/command-line-diagnostics.nll.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error[E0384]: cannot assign twice to immutable variable `x`
22
--> $DIR/command-line-diagnostics.rs:16:5
33
|
44
LL | let x = 42;
5-
| -- first assignment to `x`
5+
| - -- first assignment to `x`
6+
| |
7+
| consider changing this to `mut x`
68
LL | x = 43;
79
| ^^^^^^ cannot assign twice to immutable variable
810

src/test/ui/did_you_mean/issue-35937.nll.stderr

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ error[E0384]: cannot assign twice to immutable variable `s.x`
1010
--> $DIR/issue-35937.rs:26:5
1111
|
1212
LL | let s = S { x: 42 };
13-
| ----------- first assignment to `s.x`
13+
| - ----------- first assignment to `s.x`
14+
| |
15+
| consider changing this to `mut s`
1416
LL | s.x += 1; //~ ERROR cannot assign
1517
| ^^^^^^^^ cannot assign twice to immutable variable
1618

1719
error[E0384]: cannot assign twice to immutable variable `s.x`
1820
--> $DIR/issue-35937.rs:30:5
1921
|
2022
LL | fn bar(s: S) {
21-
| - first assignment to `s.x`
23+
| -
24+
| |
25+
| first assignment to `s.x`
26+
| consider changing this to `mut s`
2227
LL | s.x += 1; //~ ERROR cannot assign
2328
| ^^^^^^^^ cannot assign twice to immutable variable
2429

src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ error[E0384]: cannot assign to immutable argument `y`
1818
--> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
1919
|
2020
LL | fn foo(mut x: Ref, y: &u32) {
21-
| - argument not declared as `mut`
21+
| - consider changing this to `mut y`
2222
LL | y = x.b; //~ ERROR lifetime mismatch
2323
| ^^^^^^^ cannot assign to immutable argument
2424

src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ LL | x = 2; //~ ERROR (Ast) [E0384]
3232
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
3333
--> $DIR/liveness-assign-imm-local-notes.rs:23:9
3434
|
35+
LL | let x;
36+
| - consider changing this to `mut x`
37+
...
3538
LL | x = 2;
3639
| ----- first assignment to `x`
3740
LL | x = 3; //~ ERROR (Ast) [E0384]
@@ -40,6 +43,9 @@ LL | x = 3; //~ ERROR (Ast) [E0384]
4043
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
4144
--> $DIR/liveness-assign-imm-local-notes.rs:35:13
4245
|
46+
LL | let x;
47+
| - consider changing this to `mut x`
48+
...
4349
LL | x = 2;
4450
| ----- first assignment to `x`
4551
LL | x = 3; //~ ERROR (Ast) [E0384]
@@ -48,12 +54,18 @@ LL | x = 3; //~ ERROR (Ast) [E0384]
4854
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
4955
--> $DIR/liveness-assign-imm-local-notes.rs:45:13
5056
|
57+
LL | let x;
58+
| - consider changing this to `mut x`
59+
...
5160
LL | x = 1; //~ ERROR (Ast) [E0384]
5261
| ^^^^^ cannot assign twice to immutable variable
5362

5463
error[E0384]: cannot assign twice to immutable variable `x` (Mir)
5564
--> $DIR/liveness-assign-imm-local-notes.rs:48:13
5665
|
66+
LL | let x;
67+
| - consider changing this to `mut x`
68+
...
5769
LL | x = 1; //~ ERROR (Ast) [E0384]
5870
| ----- first assignment to `x`
5971
...

0 commit comments

Comments
 (0)