2017-11-27 08:06:36 +00:00
|
|
|
fn test_drop_replace() {
|
|
|
|
let b: Box<isize>;
|
2021-04-12 22:29:09 +00:00
|
|
|
//~^ HELP consider making this binding mutable
|
2019-04-22 07:40:08 +00:00
|
|
|
//~| SUGGESTION mut b
|
|
|
|
b = Box::new(1); //~ NOTE first assignment
|
|
|
|
b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
|
|
|
|
//~| NOTE cannot assign twice to immutable
|
2017-11-27 08:06:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_call() {
|
2019-04-22 07:40:08 +00:00
|
|
|
let b = Box::new(1); //~ NOTE first assignment
|
2021-04-12 22:29:09 +00:00
|
|
|
//~| HELP consider making this binding mutable
|
2019-04-22 07:40:08 +00:00
|
|
|
//~| SUGGESTION mut b
|
|
|
|
b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
|
|
|
|
//~| NOTE cannot assign twice to immutable
|
2017-11-27 08:06:36 +00:00
|
|
|
}
|
|
|
|
|
2021-04-12 22:29:09 +00:00
|
|
|
fn test_args(b: Box<i32>) { //~ HELP consider making this binding mutable
|
2019-04-22 07:40:08 +00:00
|
|
|
//~| SUGGESTION mut b
|
|
|
|
b = Box::new(2); //~ ERROR cannot assign to immutable argument `b`
|
|
|
|
//~| NOTE cannot assign to immutable argument
|
2017-11-27 08:06:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|