Reword to avoid using either re-assignment or reassignment in errors
This commit is contained in:
parent
b2478052f8
commit
0e46cf4db4
10 changed files with 21 additions and 21 deletions
|
|
@ -27,8 +27,8 @@ pub fn main() {
|
|||
foo(x);
|
||||
unsafe {
|
||||
asm!("mov $1, $0" : "=r"(x) : "r"(5));
|
||||
//~^ ERROR re-assignment of immutable variable `x`
|
||||
//~| NOTE re-assignment of immutable
|
||||
//~^ ERROR cannot assign twice to immutable variable `x`
|
||||
//~| NOTE cannot assign twice to immutable
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ fn test() {
|
|||
let v: isize;
|
||||
v = 1; //~ NOTE first assignment
|
||||
println!("v={}", v);
|
||||
v = 2; //~ ERROR re-assignment of immutable variable
|
||||
//~| NOTE re-assignment of immutable
|
||||
v = 2; //~ ERROR cannot assign twice to immutable variable
|
||||
//~| NOTE cannot assign twice to immutable
|
||||
println!("v={}", v);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ struct S {
|
|||
pub fn main() {
|
||||
match 1 {
|
||||
x => {
|
||||
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
|
||||
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
|
||||
//[mir]~^ ERROR (Mir) [E0384]
|
||||
//[mir]~| ERROR (Ast) [E0384]
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ pub fn main() {
|
|||
|
||||
match E::Foo(1) {
|
||||
E::Foo(x) => {
|
||||
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
|
||||
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
|
||||
//[mir]~^ ERROR (Mir) [E0384]
|
||||
//[mir]~| ERROR (Ast) [E0384]
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ pub fn main() {
|
|||
|
||||
match (S { bar: 1 }) {
|
||||
S { bar: x } => {
|
||||
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
|
||||
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
|
||||
//[mir]~^ ERROR (Mir) [E0384]
|
||||
//[mir]~| ERROR (Ast) [E0384]
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ pub fn main() {
|
|||
|
||||
match (1,) {
|
||||
(x,) => {
|
||||
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
|
||||
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
|
||||
//[mir]~^ ERROR (Mir) [E0384]
|
||||
//[mir]~| ERROR (Ast) [E0384]
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ pub fn main() {
|
|||
|
||||
match [1,2,3] {
|
||||
[x,_,_] => {
|
||||
x += 1; //[ast]~ ERROR re-assignment of immutable variable `x`
|
||||
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
|
||||
//[mir]~^ ERROR (Mir) [E0384]
|
||||
//[mir]~| ERROR (Ast) [E0384]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
fn test() {
|
||||
let v: isize;
|
||||
loop {
|
||||
v = 1; //~ ERROR re-assignment of immutable variable
|
||||
//~^ NOTE re-assignment of immutable variable
|
||||
v = 1; //~ ERROR cannot assign twice to immutable variable
|
||||
//~^ NOTE cannot assign twice to immutable variable
|
||||
v.clone(); // just to prevent liveness warnings
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
fn test() {
|
||||
let v: isize;
|
||||
v = 2; //~ NOTE first assignment
|
||||
v += 1; //~ ERROR re-assignment of immutable variable
|
||||
//~| NOTE re-assignment of immutable
|
||||
v += 1; //~ ERROR cannot assign twice to immutable variable
|
||||
//~| NOTE cannot assign twice to immutable
|
||||
v.clone();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
fn test() {
|
||||
let v: isize = 1; //~ NOTE first assignment
|
||||
v.clone();
|
||||
v = 2; //~ ERROR re-assignment of immutable variable
|
||||
//~| NOTE re-assignment of immutable
|
||||
v = 2; //~ ERROR cannot assign twice to immutable variable
|
||||
//~| NOTE cannot assign twice to immutable
|
||||
v.clone();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ fn main() {
|
|||
let foo = &mut 1;
|
||||
|
||||
let &mut x = foo;
|
||||
x += 1; //[ast]~ ERROR re-assignment of immutable variable
|
||||
//[mir]~^ ERROR re-assignment of immutable variable `x` (Ast)
|
||||
//[mir]~| ERROR re-assignment of immutable variable `x` (Mir)
|
||||
x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
|
||||
//[mir]~^ ERROR cannot assign twice to immutable variable `x` (Ast)
|
||||
//[mir]~| ERROR cannot assign twice to immutable variable `x` (Mir)
|
||||
|
||||
// explicitly mut-ify internals
|
||||
let &mut mut x = foo;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue