Skip to content

Commit a32fca7

Browse files
committed
Update the existing compile-fail tests to reflect diagnostic changes in NLL.
1 parent 35971cc commit a32fca7

6 files changed

+8
-1
lines changed

src/test/compile-fail/assign-imm-local-twice.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
fn test() {
1515
let v: isize;
16+
//[mir]~^ NOTE consider changing this to `mut v`
1617
v = 1; //[ast]~ NOTE first assignment
1718
//[mir]~^ NOTE first assignment
1819
println!("v={}", v);

src/test/compile-fail/issue-45199.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
fn test_drop_replace() {
1515
let b: Box<isize>;
16+
//[mir]~^ NOTE consider changing this to `mut b`
1617
b = Box::new(1); //[ast]~ NOTE first assignment
1718
//[mir]~^ NOTE first assignment
1819
b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
@@ -24,14 +25,15 @@ fn test_drop_replace() {
2425
fn test_call() {
2526
let b = Box::new(1); //[ast]~ NOTE first assignment
2627
//[mir]~^ NOTE first assignment
28+
//[mir]~| NOTE consider changing this to `mut b`
2729
b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
2830
//[mir]~^ ERROR cannot assign twice to immutable variable `b`
2931
//[ast]~| NOTE cannot assign twice to immutable
3032
//[mir]~| NOTE cannot assign twice to immutable
3133
}
3234

3335
fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
34-
//[mir]~^ NOTE argument not declared as `mut`
36+
//[mir]~^ NOTE consider changing this to `mut b`
3537
b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
3638
//[mir]~^ ERROR cannot assign to immutable argument `b`
3739
//[ast]~| NOTE cannot assign twice to immutable

src/test/compile-fail/liveness-assign-imm-local-in-loop.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
fn test() {
1515
let v: isize;
16+
//[mir]~^ NOTE consider changing this to `mut v`
1617
loop {
1718
v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
1819
//[mir]~^ ERROR cannot assign twice to immutable variable `v`

src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
fn test() {
1515
let v: isize;
16+
//[mir]~^ NOTE consider changing this to `mut v`
1617
v = 2; //[ast]~ NOTE first assignment
1718
//[mir]~^ NOTE first assignment
1819
v += 1; //[ast]~ ERROR cannot assign twice to immutable variable

src/test/compile-fail/liveness-assign-imm-local-with-drop.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
fn test() {
1515
let b = Box::new(1); //[ast]~ NOTE first assignment
1616
//[mir]~^ NOTE first assignment
17+
//[mir]~| NOTE consider changing this to `mut b`
1718
drop(b);
1819
b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
1920
//[mir]~^ ERROR cannot assign twice to immutable variable `b`

src/test/compile-fail/liveness-assign-imm-local-with-init.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
fn test() {
1515
let v: isize = 1; //[ast]~ NOTE first assignment
1616
//[mir]~^ NOTE first assignment
17+
//[mir]~| NOTE consider changing this to `mut v`
1718
v.clone();
1819
v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
1920
//[mir]~^ ERROR cannot assign twice to immutable variable `v`

0 commit comments

Comments
 (0)