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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 4 deletions
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() {
Lines changed: 21 additions & 0 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 2 additions & 4 deletions
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() {
Lines changed: 56 additions & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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,
Lines changed: 20 additions & 0 deletions
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

Lines changed: 4 additions & 4 deletions
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`

0 commit comments

Comments
 (0)