]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-45199.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / issue-45199.rs
1 fn test_drop_replace() {
2     let b: Box<isize>;
3     //~^ HELP consider making this binding mutable
4     //~| SUGGESTION mut b
5     b = Box::new(1);    //~ NOTE first assignment
6     b = Box::new(2);    //~ ERROR cannot assign twice to immutable variable `b`
7                         //~| NOTE cannot assign twice to immutable
8 }
9
10 fn test_call() {
11     let b = Box::new(1);    //~ NOTE first assignment
12                             //~| HELP consider making this binding mutable
13                             //~| SUGGESTION mut b
14     b = Box::new(2);        //~ ERROR cannot assign twice to immutable variable `b`
15                             //~| NOTE cannot assign twice to immutable
16 }
17
18 fn test_args(b: Box<i32>) {  //~ HELP consider making this binding mutable
19                                 //~| SUGGESTION mut b
20     b = Box::new(2);            //~ ERROR cannot assign to immutable argument `b`
21                                 //~| NOTE cannot assign to immutable argument
22 }
23
24 fn main() {}