Skip to content

Commit 58e4b54

Browse files
committed
move tests to borrowck directory, remove feature(nll)
now compare-mode can show us the differences
1 parent 4e50c5b commit 58e4b54

16 files changed

+173
-52
lines changed

src/test/ui/nll/assign_mutable_fields.stderr renamed to src/test/ui/borrowck/assign_mutable_fields.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0381]: use of possibly uninitialized variable: `x`
2-
--> $DIR/assign_mutable_fields.rs:31:10
2+
--> $DIR/assign_mutable_fields.rs:29:10
33
|
44
LL | drop(x); //~ ERROR
55
| ^ use of possibly uninitialized `x`

src/test/ui/nll/assign_mutable_fields.rs renamed to src/test/ui/borrowck/assign_mutable_fields.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414
//
1515
// FIXME(#21232)
1616

17-
#![feature(nll)]
18-
1917
fn assign_both_fields_and_use() {
2018
let mut x: (u32, u32);
2119
x.0 = 1;
2220
x.1 = 22;
23-
drop(x.0);
24-
drop(x.1);
21+
drop(x.0); //~ ERROR
22+
drop(x.1); //~ ERROR
2523
}
2624

2725
fn assign_both_fields_the_use_var() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0381]: use of possibly uninitialized variable: `x.0`
2+
--> $DIR/assign_mutable_fields.rs:21:10
3+
|
4+
LL | drop(x.0); //~ ERROR
5+
| ^^^ use of possibly uninitialized `x.0`
6+
7+
error[E0381]: use of possibly uninitialized variable: `x.1`
8+
--> $DIR/assign_mutable_fields.rs:22:10
9+
|
10+
LL | drop(x.1); //~ ERROR
11+
| ^^^ use of possibly uninitialized `x.1`
12+
13+
error[E0381]: use of possibly uninitialized variable: `x`
14+
--> $DIR/assign_mutable_fields.rs:29:10
15+
|
16+
LL | drop(x); //~ ERROR
17+
| ^ use of possibly uninitialized `x`
18+
19+
error: aborting due to 3 previous errors
20+
21+
For more information about this error, try `rustc --explain E0381`.

src/test/ui/nll/reassignment_immutable_fields.stderr renamed to src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
2-
--> $DIR/reassignment_immutable_fields.rs:19:5
2+
--> $DIR/reassignment_immutable_fields.rs:17:5
33
|
44
LL | let x: (u32, u32);
55
| - help: consider changing this to be mutable: `mut x`
66
LL | x.0 = 1; //~ ERROR
77
| ^^^^^^^ cannot assign
88

99
error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable
10-
--> $DIR/reassignment_immutable_fields.rs:20:5
10+
--> $DIR/reassignment_immutable_fields.rs:18:5
1111
|
1212
LL | let x: (u32, u32);
1313
| - help: consider changing this to be mutable: `mut x`
@@ -16,15 +16,15 @@ LL | x.1 = 22; //~ ERROR
1616
| ^^^^^^^^ cannot assign
1717

1818
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
19-
--> $DIR/reassignment_immutable_fields.rs:27:5
19+
--> $DIR/reassignment_immutable_fields.rs:25:5
2020
|
2121
LL | let x: (u32, u32);
2222
| - help: consider changing this to be mutable: `mut x`
2323
LL | x.0 = 1; //~ ERROR
2424
| ^^^^^^^ cannot assign
2525

2626
error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable
27-
--> $DIR/reassignment_immutable_fields.rs:28:5
27+
--> $DIR/reassignment_immutable_fields.rs:26:5
2828
|
2929
LL | let x: (u32, u32);
3030
| - help: consider changing this to be mutable: `mut x`
@@ -33,7 +33,7 @@ LL | x.1 = 22; //~ ERROR
3333
| ^^^^^^^^ cannot assign
3434

3535
error[E0381]: use of possibly uninitialized variable: `x`
36-
--> $DIR/reassignment_immutable_fields.rs:29:10
36+
--> $DIR/reassignment_immutable_fields.rs:27:10
3737
|
3838
LL | drop(x); //~ ERROR
3939
| ^ use of possibly uninitialized `x`

src/test/ui/nll/reassignment_immutable_fields.rs renamed to src/test/ui/borrowck/reassignment_immutable_fields.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
//
1313
// FIXME(#21232)
1414

15-
#![feature(nll)]
16-
1715
fn assign_both_fields_and_use() {
1816
let x: (u32, u32);
1917
x.0 = 1; //~ ERROR
2018
x.1 = 22; //~ ERROR
21-
drop(x.0);
22-
drop(x.1);
19+
drop(x.0); //~ ERROR
20+
drop(x.1); //~ ERROR
2321
}
2422

2523
fn assign_both_fields_the_use_var() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
error[E0594]: cannot assign to field `x.0` of immutable binding
2+
--> $DIR/reassignment_immutable_fields.rs:17:5
3+
|
4+
LL | let x: (u32, u32);
5+
| - consider changing this to `mut x`
6+
LL | x.0 = 1; //~ ERROR
7+
| ^^^^^^^ cannot mutably borrow field of immutable binding
8+
9+
error[E0594]: cannot assign to field `x.1` of immutable binding
10+
--> $DIR/reassignment_immutable_fields.rs:18:5
11+
|
12+
LL | let x: (u32, u32);
13+
| - consider changing this to `mut x`
14+
LL | x.0 = 1; //~ ERROR
15+
LL | x.1 = 22; //~ ERROR
16+
| ^^^^^^^^ cannot mutably borrow field of immutable binding
17+
18+
error[E0381]: use of possibly uninitialized variable: `x.0`
19+
--> $DIR/reassignment_immutable_fields.rs:19:10
20+
|
21+
LL | drop(x.0); //~ ERROR
22+
| ^^^ use of possibly uninitialized `x.0`
23+
24+
error[E0381]: use of possibly uninitialized variable: `x.1`
25+
--> $DIR/reassignment_immutable_fields.rs:20:10
26+
|
27+
LL | drop(x.1); //~ ERROR
28+
| ^^^ use of possibly uninitialized `x.1`
29+
30+
error[E0594]: cannot assign to field `x.0` of immutable binding
31+
--> $DIR/reassignment_immutable_fields.rs:25:5
32+
|
33+
LL | let x: (u32, u32);
34+
| - consider changing this to `mut x`
35+
LL | x.0 = 1; //~ ERROR
36+
| ^^^^^^^ cannot mutably borrow field of immutable binding
37+
38+
error[E0594]: cannot assign to field `x.1` of immutable binding
39+
--> $DIR/reassignment_immutable_fields.rs:26:5
40+
|
41+
LL | let x: (u32, u32);
42+
| - consider changing this to `mut x`
43+
LL | x.0 = 1; //~ ERROR
44+
LL | x.1 = 22; //~ ERROR
45+
| ^^^^^^^^ cannot mutably borrow field of immutable binding
46+
47+
error[E0381]: use of possibly uninitialized variable: `x`
48+
--> $DIR/reassignment_immutable_fields.rs:27:10
49+
|
50+
LL | drop(x); //~ ERROR
51+
| ^ use of possibly uninitialized `x`
52+
53+
error: aborting due to 7 previous errors
54+
55+
Some errors occurred: E0381, E0594.
56+
For more information about an error, try `rustc --explain E0381`.

src/test/ui/nll/reassignment_immutable_fields_overlapping.stderr renamed to src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0594]: cannot assign to `x.a`, as `x` is not declared as mutable
2-
--> $DIR/reassignment_immutable_fields_overlapping.rs:24:5
2+
--> $DIR/reassignment_immutable_fields_overlapping.rs:22:5
33
|
44
LL | let x: Foo;
55
| - help: consider changing this to be mutable: `mut x`
66
LL | x.a = 1; //~ ERROR
77
| ^^^^^^^ cannot assign
88

99
error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable
10-
--> $DIR/reassignment_immutable_fields_overlapping.rs:25:5
10+
--> $DIR/reassignment_immutable_fields_overlapping.rs:23:5
1111
|
1212
LL | let x: Foo;
1313
| - help: consider changing this to be mutable: `mut x`

src/test/ui/nll/reassignment_immutable_fields_overlapping.rs renamed to src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// overlapping, so since `x` is not `mut` we should not permit
1313
// reassignment.
1414

15-
#![feature(nll)]
16-
1715
union Foo {
1816
a: u32,
1917
b: u32,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0594]: cannot assign to field `x.a` of immutable binding
2+
--> $DIR/reassignment_immutable_fields_overlapping.rs:22:5
3+
|
4+
LL | let x: Foo;
5+
| - consider changing this to `mut x`
6+
LL | x.a = 1; //~ ERROR
7+
| ^^^^^^^ cannot mutably borrow field of immutable binding
8+
9+
error[E0594]: cannot assign to field `x.b` of immutable binding
10+
--> $DIR/reassignment_immutable_fields_overlapping.rs:23:5
11+
|
12+
LL | let x: Foo;
13+
| - consider changing this to `mut x`
14+
LL | x.a = 1; //~ ERROR
15+
LL | x.b = 22; //~ ERROR
16+
| ^^^^^^^^ cannot mutably borrow field of immutable binding
17+
18+
error: aborting due to 2 previous errors
19+
20+
For more information about this error, try `rustc --explain E0594`.

src/test/ui/nll/reassignment_immutable_fields_twice.stderr renamed to src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
2-
--> $DIR/reassignment_immutable_fields_twice.rs:19:5
2+
--> $DIR/reassignment_immutable_fields_twice.rs:17:5
33
|
44
LL | let x: (u32, u32);
55
| - help: consider changing this to be mutable: `mut x`
@@ -8,15 +8,15 @@ LL | x.0 = 1; //~ ERROR
88
| ^^^^^^^ cannot assign
99

1010
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
11-
--> $DIR/reassignment_immutable_fields_twice.rs:24:5
11+
--> $DIR/reassignment_immutable_fields_twice.rs:22:5
1212
|
1313
LL | let x: (u32, u32);
1414
| - help: consider changing this to be mutable: `mut x`
1515
LL | x.0 = 1; //~ ERROR
1616
| ^^^^^^^ cannot assign
1717

1818
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
19-
--> $DIR/reassignment_immutable_fields_twice.rs:25:5
19+
--> $DIR/reassignment_immutable_fields_twice.rs:23:5
2020
|
2121
LL | let x: (u32, u32);
2222
| - help: consider changing this to be mutable: `mut x`
@@ -25,7 +25,7 @@ LL | x.0 = 22; //~ ERROR
2525
| ^^^^^^^^ cannot assign
2626

2727
error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable
28-
--> $DIR/reassignment_immutable_fields_twice.rs:26:5
28+
--> $DIR/reassignment_immutable_fields_twice.rs:24:5
2929
|
3030
LL | let x: (u32, u32);
3131
| - help: consider changing this to be mutable: `mut x`

src/test/ui/nll/reassignment_immutable_fields_twice.rs renamed to src/test/ui/borrowck/reassignment_immutable_fields_twice.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
// This should never be allowed -- since `x` is not `mut`, so `x.0`
1212
// cannot be assigned twice.
1313

14-
#![feature(nll)]
15-
1614
fn var_then_field() {
1715
let x: (u32, u32);
1816
x = (22, 44);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
error[E0594]: cannot assign to field `x.0` of immutable binding
2+
--> $DIR/reassignment_immutable_fields_twice.rs:17:5
3+
|
4+
LL | let x: (u32, u32);
5+
| - consider changing this to `mut x`
6+
LL | x = (22, 44);
7+
LL | x.0 = 1; //~ ERROR
8+
| ^^^^^^^ cannot mutably borrow field of immutable binding
9+
10+
error[E0594]: cannot assign to field `x.0` of immutable binding
11+
--> $DIR/reassignment_immutable_fields_twice.rs:22:5
12+
|
13+
LL | let x: (u32, u32);
14+
| - consider changing this to `mut x`
15+
LL | x.0 = 1; //~ ERROR
16+
| ^^^^^^^ cannot mutably borrow field of immutable binding
17+
18+
error[E0594]: cannot assign to field `x.0` of immutable binding
19+
--> $DIR/reassignment_immutable_fields_twice.rs:23:5
20+
|
21+
LL | let x: (u32, u32);
22+
| - consider changing this to `mut x`
23+
LL | x.0 = 1; //~ ERROR
24+
LL | x.0 = 22; //~ ERROR
25+
| ^^^^^^^^ cannot mutably borrow field of immutable binding
26+
27+
error[E0594]: cannot assign to field `x.1` of immutable binding
28+
--> $DIR/reassignment_immutable_fields_twice.rs:24:5
29+
|
30+
LL | let x: (u32, u32);
31+
| - consider changing this to `mut x`
32+
...
33+
LL | x.1 = 44; //~ ERROR
34+
| ^^^^^^^^ cannot mutably borrow field of immutable binding
35+
36+
error: aborting due to 4 previous errors
37+
38+
For more information about this error, try `rustc --explain E0594`.
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
error[E0384]: cannot assign to immutable argument `y`
1+
error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
22
--> $DIR/immut-function-arguments.rs:15:5
33
|
44
LL | fn f(y: Box<isize>) {
5-
| - consider changing this to `mut y`
5+
| - help: consider changing this to be mutable: `mut y`
66
LL | *y = 5; //[ast]~ ERROR cannot assign
7-
| ^^^^^^ cannot assign to immutable argument
7+
| ^^^^^^ cannot assign
88

9-
error[E0384]: cannot assign to immutable argument `q`
9+
error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
1010
--> $DIR/immut-function-arguments.rs:20:35
1111
|
1212
LL | let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
13-
| - ^^^^^^ cannot assign to immutable argument
13+
| - ^^^^^^ cannot assign
1414
| |
15-
| consider changing this to `mut q`
15+
| help: consider changing this to be mutable: `mut q`
1616

1717
error: aborting due to 2 previous errors
1818

19-
For more information about this error, try `rustc --explain E0384`.
19+
For more information about this error, try `rustc --explain E0594`.
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
error[E0384]: cannot assign to immutable argument `y`
1+
error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
22
--> $DIR/immut-function-arguments.rs:15:5
33
|
44
LL | fn f(y: Box<isize>) {
5-
| - consider changing this to `mut y`
5+
| - help: consider changing this to be mutable: `mut y`
66
LL | *y = 5; //[ast]~ ERROR cannot assign
7-
| ^^^^^^ cannot assign to immutable argument
7+
| ^^^^^^ cannot assign
88

9-
error[E0384]: cannot assign to immutable argument `q`
9+
error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
1010
--> $DIR/immut-function-arguments.rs:20:35
1111
|
1212
LL | let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
13-
| - ^^^^^^ cannot assign to immutable argument
13+
| - ^^^^^^ cannot assign
1414
| |
15-
| consider changing this to `mut q`
15+
| help: consider changing this to be mutable: `mut q`
1616

1717
error: aborting due to 2 previous errors
1818

19-
For more information about this error, try `rustc --explain E0384`.
19+
For more information about this error, try `rustc --explain E0594`.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
error[E0384]: cannot assign twice to immutable variable `nyan`
1+
error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
22
--> $DIR/mutable-class-fields.rs:28:3
33
|
44
LL | let nyan : cat = cat(52, 99);
5-
| ----
6-
| |
7-
| first assignment to `nyan`
8-
| consider changing this to `mut nyan`
5+
| ---- help: consider changing this to be mutable: `mut nyan`
96
LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign
10-
| ^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
7+
| ^^^^^^^^^^^^^^^^^^^ cannot assign
118

129
error: aborting due to previous error
1310

14-
For more information about this error, try `rustc --explain E0384`.
11+
For more information about this error, try `rustc --explain E0594`.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
error[E0384]: cannot assign twice to immutable variable `nyan`
1+
error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
22
--> $DIR/mutable-class-fields.rs:28:3
33
|
44
LL | let nyan : cat = cat(52, 99);
5-
| ----
6-
| |
7-
| first assignment to `nyan`
8-
| consider changing this to `mut nyan`
5+
| ---- help: consider changing this to be mutable: `mut nyan`
96
LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign
10-
| ^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
7+
| ^^^^^^^^^^^^^^^^^^^ cannot assign
118

129
error: aborting due to previous error
1310

14-
For more information about this error, try `rustc --explain E0384`.
11+
For more information about this error, try `rustc --explain E0594`.

0 commit comments

Comments
 (0)