2017-11-27 02:06:36 -06:00
|
|
|
fn test_drop_replace() {
|
|
|
|
let b: Box<isize>;
|
2021-04-12 17:29:09 -05:00
|
|
|
//~^ HELP consider making this binding mutable
|
2019-04-22 02:40:08 -05: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
|
2023-02-08 15:29:52 -06:00
|
|
|
//~| NOTE in this expansion of desugaring of drop and replace
|
2017-11-27 02:06:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_call() {
|
2019-04-22 02:40:08 -05:00
|
|
|
let b = Box::new(1); //~ NOTE first assignment
|
2021-04-12 17:29:09 -05:00
|
|
|
//~| HELP consider making this binding mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
//~| SUGGESTION mut b
|
|
|
|
b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
|
|
|
|
//~| NOTE cannot assign twice to immutable
|
2023-02-08 15:29:52 -06:00
|
|
|
//~| NOTE in this expansion of desugaring of drop and replace
|
2017-11-27 02:06:36 -06:00
|
|
|
}
|
|
|
|
|
2021-04-12 17:29:09 -05:00
|
|
|
fn test_args(b: Box<i32>) { //~ HELP consider making this binding mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
//~| SUGGESTION mut b
|
|
|
|
b = Box::new(2); //~ ERROR cannot assign to immutable argument `b`
|
|
|
|
//~| NOTE cannot assign to immutable argument
|
2023-02-08 15:29:52 -06:00
|
|
|
//~| NOTE in this expansion of desugaring of drop and replace
|
2017-11-27 02:06:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|