Update tests for new NLL mutability errors

This commit is contained in:
Matthew Jasper 2018-07-17 20:29:48 +01:00
parent 13b5f69848
commit a06b2433fc
52 changed files with 1129 additions and 89 deletions

View file

@ -15,5 +15,5 @@ static NUM: i32 = 18;
fn main() {
NUM = 20; //[ast]~ ERROR E0594
//[mir]~^ ERROR cannot assign to immutable item `NUM`
//[mir]~^ ERROR cannot assign to immutable static item `NUM`
}

View file

@ -16,5 +16,5 @@ static foo: isize = 5;
fn main() {
// assigning to various global constants
foo = 6; //[ast]~ ERROR cannot assign to immutable static item
//[mir]~^ ERROR cannot assign to immutable item `foo`
//[mir]~^ ERROR cannot assign to immutable static item `foo`
}

View file

@ -22,10 +22,10 @@ fn main() {
let x = 1;
to_fn_once(move|| { x = 2; });
//[ast]~^ ERROR: cannot assign to immutable captured outer variable
//[mir]~^^ ERROR: cannot assign to immutable item `x`
//[mir]~^^ ERROR: cannot assign to `x`, as it is not declared as mutable
let s = std::io::stdin();
to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
//[ast]~^ ERROR: cannot borrow immutable captured outer variable
//[mir]~^^ ERROR: cannot borrow immutable item `s` as mutable
//[mir]~^^ ERROR: cannot borrow `s` as mutable, as it is not declared as mutable
}

View file

@ -17,5 +17,5 @@
static FOO: isize = 5;
fn main() {
FOO = 6; //~ ERROR cannot assign to immutable item `FOO` [E0594]
FOO = 6; //~ ERROR cannot assign to immutable static item `FOO` [E0594]
}