diff --git a/src/test/ui/nll/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.nll.stderr similarity index 85% rename from src/test/ui/nll/assign_mutable_fields.stderr rename to src/test/ui/borrowck/assign_mutable_fields.nll.stderr index 278dcce4acde..514707534728 100644 --- a/src/test/ui/nll/assign_mutable_fields.stderr +++ b/src/test/ui/borrowck/assign_mutable_fields.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/assign_mutable_fields.rs:31:10 + --> $DIR/assign_mutable_fields.rs:29:10 | LL | drop(x); //~ ERROR | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/nll/assign_mutable_fields.rs b/src/test/ui/borrowck/assign_mutable_fields.rs similarity index 94% rename from src/test/ui/nll/assign_mutable_fields.rs rename to src/test/ui/borrowck/assign_mutable_fields.rs index 8025b998d5d1..4e41f44ef5bb 100644 --- a/src/test/ui/nll/assign_mutable_fields.rs +++ b/src/test/ui/borrowck/assign_mutable_fields.rs @@ -14,14 +14,12 @@ // // FIXME(#21232) -#![feature(nll)] - fn assign_both_fields_and_use() { let mut x: (u32, u32); x.0 = 1; x.1 = 22; - drop(x.0); - drop(x.1); + drop(x.0); //~ ERROR + drop(x.1); //~ ERROR } fn assign_both_fields_the_use_var() { diff --git a/src/test/ui/borrowck/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.stderr new file mode 100644 index 000000000000..677887babd03 --- /dev/null +++ b/src/test/ui/borrowck/assign_mutable_fields.stderr @@ -0,0 +1,21 @@ +error[E0381]: use of possibly uninitialized variable: `x.0` + --> $DIR/assign_mutable_fields.rs:21:10 + | +LL | drop(x.0); //~ ERROR + | ^^^ use of possibly uninitialized `x.0` + +error[E0381]: use of possibly uninitialized variable: `x.1` + --> $DIR/assign_mutable_fields.rs:22:10 + | +LL | drop(x.1); //~ ERROR + | ^^^ use of possibly uninitialized `x.1` + +error[E0381]: use of possibly uninitialized variable: `x` + --> $DIR/assign_mutable_fields.rs:29:10 + | +LL | drop(x); //~ ERROR + | ^ use of possibly uninitialized `x` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0381`. diff --git a/src/test/ui/nll/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr similarity index 83% rename from src/test/ui/nll/reassignment_immutable_fields.stderr rename to src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr index 853e82d0e992..97f3bf5b81f6 100644 --- a/src/test/ui/nll/reassignment_immutable_fields.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields.rs:19:5 + --> $DIR/reassignment_immutable_fields.rs:17:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -7,7 +7,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields.rs:20:5 + --> $DIR/reassignment_immutable_fields.rs:18:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -16,7 +16,7 @@ LL | x.1 = 22; //~ ERROR | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields.rs:27:5 + --> $DIR/reassignment_immutable_fields.rs:25:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -24,7 +24,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields.rs:28:5 + --> $DIR/reassignment_immutable_fields.rs:26:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | x.1 = 22; //~ ERROR | ^^^^^^^^ cannot assign error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/reassignment_immutable_fields.rs:29:10 + --> $DIR/reassignment_immutable_fields.rs:27:10 | LL | drop(x); //~ ERROR | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/nll/reassignment_immutable_fields.rs b/src/test/ui/borrowck/reassignment_immutable_fields.rs similarity index 94% rename from src/test/ui/nll/reassignment_immutable_fields.rs rename to src/test/ui/borrowck/reassignment_immutable_fields.rs index 3660017e75dc..c49ae2f9567f 100644 --- a/src/test/ui/nll/reassignment_immutable_fields.rs +++ b/src/test/ui/borrowck/reassignment_immutable_fields.rs @@ -12,14 +12,12 @@ // // FIXME(#21232) -#![feature(nll)] - fn assign_both_fields_and_use() { let x: (u32, u32); x.0 = 1; //~ ERROR x.1 = 22; //~ ERROR - drop(x.0); - drop(x.1); + drop(x.0); //~ ERROR + drop(x.1); //~ ERROR } fn assign_both_fields_the_use_var() { diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.stderr new file mode 100644 index 000000000000..54d12f8fae85 --- /dev/null +++ b/src/test/ui/borrowck/reassignment_immutable_fields.stderr @@ -0,0 +1,56 @@ +error[E0594]: cannot assign to field `x.0` of immutable binding + --> $DIR/reassignment_immutable_fields.rs:17:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +LL | x.0 = 1; //~ ERROR + | ^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0594]: cannot assign to field `x.1` of immutable binding + --> $DIR/reassignment_immutable_fields.rs:18:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +LL | x.0 = 1; //~ ERROR +LL | x.1 = 22; //~ ERROR + | ^^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0381]: use of possibly uninitialized variable: `x.0` + --> $DIR/reassignment_immutable_fields.rs:19:10 + | +LL | drop(x.0); //~ ERROR + | ^^^ use of possibly uninitialized `x.0` + +error[E0381]: use of possibly uninitialized variable: `x.1` + --> $DIR/reassignment_immutable_fields.rs:20:10 + | +LL | drop(x.1); //~ ERROR + | ^^^ use of possibly uninitialized `x.1` + +error[E0594]: cannot assign to field `x.0` of immutable binding + --> $DIR/reassignment_immutable_fields.rs:25:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +LL | x.0 = 1; //~ ERROR + | ^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0594]: cannot assign to field `x.1` of immutable binding + --> $DIR/reassignment_immutable_fields.rs:26:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +LL | x.0 = 1; //~ ERROR +LL | x.1 = 22; //~ ERROR + | ^^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0381]: use of possibly uninitialized variable: `x` + --> $DIR/reassignment_immutable_fields.rs:27:10 + | +LL | drop(x); //~ ERROR + | ^ use of possibly uninitialized `x` + +error: aborting due to 7 previous errors + +Some errors occurred: E0381, E0594. +For more information about an error, try `rustc --explain E0381`. diff --git a/src/test/ui/nll/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr similarity index 82% rename from src/test/ui/nll/reassignment_immutable_fields_overlapping.stderr rename to src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr index 1981b1497002..c433d6e25c9d 100644 --- a/src/test/ui/nll/reassignment_immutable_fields_overlapping.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x.a`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_overlapping.rs:24:5 + --> $DIR/reassignment_immutable_fields_overlapping.rs:22:5 | LL | let x: Foo; | - help: consider changing this to be mutable: `mut x` @@ -7,7 +7,7 @@ LL | x.a = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_overlapping.rs:25:5 + --> $DIR/reassignment_immutable_fields_overlapping.rs:23:5 | LL | let x: Foo; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/nll/reassignment_immutable_fields_overlapping.rs b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs similarity index 97% rename from src/test/ui/nll/reassignment_immutable_fields_overlapping.rs rename to src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs index 17a82bf0c9be..add23ec8f245 100644 --- a/src/test/ui/nll/reassignment_immutable_fields_overlapping.rs +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs @@ -12,8 +12,6 @@ // overlapping, so since `x` is not `mut` we should not permit // reassignment. -#![feature(nll)] - union Foo { a: u32, b: u32, diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr new file mode 100644 index 000000000000..70849905f92a --- /dev/null +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr @@ -0,0 +1,20 @@ +error[E0594]: cannot assign to field `x.a` of immutable binding + --> $DIR/reassignment_immutable_fields_overlapping.rs:22:5 + | +LL | let x: Foo; + | - consider changing this to `mut x` +LL | x.a = 1; //~ ERROR + | ^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0594]: cannot assign to field `x.b` of immutable binding + --> $DIR/reassignment_immutable_fields_overlapping.rs:23:5 + | +LL | let x: Foo; + | - consider changing this to `mut x` +LL | x.a = 1; //~ ERROR +LL | x.b = 22; //~ ERROR + | ^^^^^^^^ cannot mutably borrow field of immutable binding + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/nll/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr similarity index 87% rename from src/test/ui/nll/reassignment_immutable_fields_twice.stderr rename to src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr index cf0461f275c9..2160ae20c425 100644 --- a/src/test/ui/nll/reassignment_immutable_fields_twice.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_twice.rs:19:5 + --> $DIR/reassignment_immutable_fields_twice.rs:17:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -8,7 +8,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_twice.rs:24:5 + --> $DIR/reassignment_immutable_fields_twice.rs:22:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -16,7 +16,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_twice.rs:25:5 + --> $DIR/reassignment_immutable_fields_twice.rs:23:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | x.0 = 22; //~ ERROR | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_twice.rs:26:5 + --> $DIR/reassignment_immutable_fields_twice.rs:24:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/nll/reassignment_immutable_fields_twice.rs b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs similarity index 97% rename from src/test/ui/nll/reassignment_immutable_fields_twice.rs rename to src/test/ui/borrowck/reassignment_immutable_fields_twice.rs index e413ad4f9473..c7e7e5c45335 100644 --- a/src/test/ui/nll/reassignment_immutable_fields_twice.rs +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs @@ -11,8 +11,6 @@ // This should never be allowed -- since `x` is not `mut`, so `x.0` // cannot be assigned twice. -#![feature(nll)] - fn var_then_field() { let x: (u32, u32); x = (22, 44); diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr new file mode 100644 index 000000000000..b3c013d8b1f4 --- /dev/null +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr @@ -0,0 +1,38 @@ +error[E0594]: cannot assign to field `x.0` of immutable binding + --> $DIR/reassignment_immutable_fields_twice.rs:17:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +LL | x = (22, 44); +LL | x.0 = 1; //~ ERROR + | ^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0594]: cannot assign to field `x.0` of immutable binding + --> $DIR/reassignment_immutable_fields_twice.rs:22:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +LL | x.0 = 1; //~ ERROR + | ^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0594]: cannot assign to field `x.0` of immutable binding + --> $DIR/reassignment_immutable_fields_twice.rs:23:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +LL | x.0 = 1; //~ ERROR +LL | x.0 = 22; //~ ERROR + | ^^^^^^^^ cannot mutably borrow field of immutable binding + +error[E0594]: cannot assign to field `x.1` of immutable binding + --> $DIR/reassignment_immutable_fields_twice.rs:24:5 + | +LL | let x: (u32, u32); + | - consider changing this to `mut x` +... +LL | x.1 = 44; //~ ERROR + | ^^^^^^^^ cannot mutably borrow field of immutable binding + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/immut-function-arguments.ast.nll.stderr b/src/test/ui/immut-function-arguments.ast.nll.stderr index c82363406274..d33814a0fc5f 100644 --- a/src/test/ui/immut-function-arguments.ast.nll.stderr +++ b/src/test/ui/immut-function-arguments.ast.nll.stderr @@ -1,19 +1,19 @@ -error[E0384]: cannot assign to immutable argument `y` +error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable --> $DIR/immut-function-arguments.rs:15:5 | LL | fn f(y: Box) { - | - consider changing this to `mut y` + | - help: consider changing this to be mutable: `mut y` LL | *y = 5; //[ast]~ ERROR cannot assign - | ^^^^^^ cannot assign to immutable argument + | ^^^^^^ cannot assign -error[E0384]: cannot assign to immutable argument `q` +error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable --> $DIR/immut-function-arguments.rs:20:35 | LL | let _frob = |q: Box| { *q = 2; }; //[ast]~ ERROR cannot assign - | - ^^^^^^ cannot assign to immutable argument + | - ^^^^^^ cannot assign | | - | consider changing this to `mut q` + | help: consider changing this to be mutable: `mut q` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0384`. +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/immut-function-arguments.mir.stderr b/src/test/ui/immut-function-arguments.mir.stderr index c82363406274..d33814a0fc5f 100644 --- a/src/test/ui/immut-function-arguments.mir.stderr +++ b/src/test/ui/immut-function-arguments.mir.stderr @@ -1,19 +1,19 @@ -error[E0384]: cannot assign to immutable argument `y` +error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable --> $DIR/immut-function-arguments.rs:15:5 | LL | fn f(y: Box) { - | - consider changing this to `mut y` + | - help: consider changing this to be mutable: `mut y` LL | *y = 5; //[ast]~ ERROR cannot assign - | ^^^^^^ cannot assign to immutable argument + | ^^^^^^ cannot assign -error[E0384]: cannot assign to immutable argument `q` +error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable --> $DIR/immut-function-arguments.rs:20:35 | LL | let _frob = |q: Box| { *q = 2; }; //[ast]~ ERROR cannot assign - | - ^^^^^^ cannot assign to immutable argument + | - ^^^^^^ cannot assign | | - | consider changing this to `mut q` + | help: consider changing this to be mutable: `mut q` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0384`. +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/mut/mutable-class-fields.ast.nll.stderr b/src/test/ui/mut/mutable-class-fields.ast.nll.stderr index 1d1e58de587d..033a3bd6cb4c 100644 --- a/src/test/ui/mut/mutable-class-fields.ast.nll.stderr +++ b/src/test/ui/mut/mutable-class-fields.ast.nll.stderr @@ -1,14 +1,11 @@ -error[E0384]: cannot assign twice to immutable variable `nyan` +error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable --> $DIR/mutable-class-fields.rs:28:3 | LL | let nyan : cat = cat(52, 99); - | ---- - | | - | first assignment to `nyan` - | consider changing this to `mut nyan` + | ---- help: consider changing this to be mutable: `mut nyan` LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign - | ^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^^^^^^^^^^^^^^^^^^^ cannot assign error: aborting due to previous error -For more information about this error, try `rustc --explain E0384`. +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/mut/mutable-class-fields.mir.stderr b/src/test/ui/mut/mutable-class-fields.mir.stderr index 1d1e58de587d..033a3bd6cb4c 100644 --- a/src/test/ui/mut/mutable-class-fields.mir.stderr +++ b/src/test/ui/mut/mutable-class-fields.mir.stderr @@ -1,14 +1,11 @@ -error[E0384]: cannot assign twice to immutable variable `nyan` +error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable --> $DIR/mutable-class-fields.rs:28:3 | LL | let nyan : cat = cat(52, 99); - | ---- - | | - | first assignment to `nyan` - | consider changing this to `mut nyan` + | ---- help: consider changing this to be mutable: `mut nyan` LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign - | ^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^^^^^^^^^^^^^^^^^^^ cannot assign error: aborting due to previous error -For more information about this error, try `rustc --explain E0384`. +For more information about this error, try `rustc --explain E0594`.