2017-11-27 02:07:58 -06:00
|
|
|
// revisions: ast mir
|
|
|
|
//[mir]compile-flags: -Zborrowck=mir
|
|
|
|
|
|
|
|
fn test() {
|
|
|
|
let b = Box::new(1); //[ast]~ NOTE first assignment
|
|
|
|
//[mir]~^ NOTE first assignment
|
2018-09-12 13:13:40 -05:00
|
|
|
//[mir]~| HELP make this binding mutable
|
|
|
|
//[mir]~| SUGGESTION mut b
|
2017-11-27 02:07:58 -06:00
|
|
|
drop(b);
|
|
|
|
b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
|
|
|
|
//[mir]~^ ERROR cannot assign twice to immutable variable `b`
|
|
|
|
//[ast]~| NOTE cannot assign twice to immutable
|
|
|
|
//[mir]~| NOTE cannot assign twice to immutable
|
|
|
|
drop(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|