diff --git a/src/test/ui/asm-out-assign-imm.nll.stderr b/src/test/ui/asm-out-assign-imm.nll.stderr new file mode 100644 index 00000000000..fbd58cd4c22 --- /dev/null +++ b/src/test/ui/asm-out-assign-imm.nll.stderr @@ -0,0 +1,14 @@ +error[E0384]: cannot assign twice to immutable variable `x` + --> $DIR/asm-out-assign-imm.rs:33:9 + | +LL | let x: isize; + | - consider changing this to `mut x` +LL | x = 1; + | ----- first assignment to `x` +... +LL | asm!("mov $1, $0" : "=r"(x) : "r"(5)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0384`. diff --git a/src/test/ui/borrowck/immutable-arg.stderr b/src/test/ui/borrowck/immutable-arg.stderr index b7506849b81..1cf68795bf0 100644 --- a/src/test/ui/borrowck/immutable-arg.stderr +++ b/src/test/ui/borrowck/immutable-arg.stderr @@ -10,7 +10,7 @@ error[E0384]: cannot assign to immutable argument `_x` (Mir) --> $DIR/immutable-arg.rs:14:5 | LL | fn foo(_x: u32) { - | -- argument not declared as `mut` + | -- consider changing this to `mut _x` LL | _x = 4; | ^^^^^^ cannot assign to immutable argument diff --git a/src/test/ui/command-line-diagnostics.nll.stderr b/src/test/ui/command-line-diagnostics.nll.stderr index 2d5a31f0586..10dcf7d0e65 100644 --- a/src/test/ui/command-line-diagnostics.nll.stderr +++ b/src/test/ui/command-line-diagnostics.nll.stderr @@ -2,7 +2,9 @@ error[E0384]: cannot assign twice to immutable variable `x` --> $DIR/command-line-diagnostics.rs:16:5 | LL | let x = 42; - | -- first assignment to `x` + | - -- first assignment to `x` + | | + | consider changing this to `mut x` LL | x = 43; | ^^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr index f070921558f..0c1dcb29d4d 100644 --- a/src/test/ui/did_you_mean/issue-35937.nll.stderr +++ b/src/test/ui/did_you_mean/issue-35937.nll.stderr @@ -10,7 +10,9 @@ error[E0384]: cannot assign twice to immutable variable `s.x` --> $DIR/issue-35937.rs:26:5 | LL | let s = S { x: 42 }; - | ----------- first assignment to `s.x` + | - ----------- first assignment to `s.x` + | | + | consider changing this to `mut s` LL | s.x += 1; //~ ERROR cannot assign | ^^^^^^^^ cannot assign twice to immutable variable @@ -18,7 +20,10 @@ error[E0384]: cannot assign twice to immutable variable `s.x` --> $DIR/issue-35937.rs:30:5 | LL | fn bar(s: S) { - | - first assignment to `s.x` + | - + | | + | first assignment to `s.x` + | consider changing this to `mut s` LL | s.x += 1; //~ ERROR cannot assign | ^^^^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr index 9d6d68f518d..93f2837c0fc 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr @@ -18,7 +18,7 @@ error[E0384]: cannot assign to immutable argument `y` --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5 | LL | fn foo(mut x: Ref, y: &u32) { - | - argument not declared as `mut` + | - consider changing this to `mut y` LL | y = x.b; //~ ERROR lifetime mismatch | ^^^^^^^ cannot assign to immutable argument diff --git a/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr index 43743118966..0620235371a 100644 --- a/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr +++ b/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr @@ -32,6 +32,9 @@ LL | x = 2; //~ ERROR (Ast) [E0384] error[E0384]: cannot assign twice to immutable variable `x` (Mir) --> $DIR/liveness-assign-imm-local-notes.rs:23:9 | +LL | let x; + | - consider changing this to `mut x` +... LL | x = 2; | ----- first assignment to `x` LL | x = 3; //~ ERROR (Ast) [E0384] @@ -40,6 +43,9 @@ LL | x = 3; //~ ERROR (Ast) [E0384] error[E0384]: cannot assign twice to immutable variable `x` (Mir) --> $DIR/liveness-assign-imm-local-notes.rs:35:13 | +LL | let x; + | - consider changing this to `mut x` +... LL | x = 2; | ----- first assignment to `x` LL | x = 3; //~ ERROR (Ast) [E0384] @@ -48,12 +54,18 @@ LL | x = 3; //~ ERROR (Ast) [E0384] error[E0384]: cannot assign twice to immutable variable `x` (Mir) --> $DIR/liveness-assign-imm-local-notes.rs:45:13 | +LL | let x; + | - consider changing this to `mut x` +... LL | x = 1; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) --> $DIR/liveness-assign-imm-local-notes.rs:48:13 | +LL | let x; + | - consider changing this to `mut x` +... LL | x = 1; //~ ERROR (Ast) [E0384] | ----- first assignment to `x` ...