2 //[mir]compile-flags: -Zborrowck=mir
4 fn test_drop_replace() {
6 //[mir]~^ HELP make this binding mutable
7 //[mir]~| SUGGESTION mut b
8 b = Box::new(1); //[ast]~ NOTE first assignment
9 //[mir]~^ NOTE first assignment
10 b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
11 //[mir]~^ ERROR cannot assign twice to immutable variable `b`
12 //[ast]~| NOTE cannot assign twice to immutable
13 //[mir]~| NOTE cannot assign twice to immutable
17 let b = Box::new(1); //[ast]~ NOTE first assignment
18 //[mir]~^ NOTE first assignment
19 //[mir]~| HELP make this binding mutable
20 //[mir]~| SUGGESTION mut b
21 b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
22 //[mir]~^ ERROR cannot assign twice to immutable variable `b`
23 //[ast]~| NOTE cannot assign twice to immutable
24 //[mir]~| NOTE cannot assign twice to immutable
27 fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
28 //[mir]~^ HELP make this binding mutable
29 //[mir]~| SUGGESTION mut b
30 b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
31 //[mir]~^ ERROR cannot assign to immutable argument `b`
32 //[ast]~| NOTE cannot assign twice to immutable
33 //[mir]~| NOTE cannot assign to immutable argument