]> git.lizzy.rs Git - rust.git/blob - src/test/ui/assign-imm-local-twice.rs
Auto merge of #57035 - Zoxc:query-pref9, r=michaelwoerister
[rust.git] / src / test / ui / assign-imm-local-twice.rs
1 // revisions: ast mir
2 //[mir]compile-flags: -Zborrowck=mir
3
4 fn test() {
5     let v: isize;
6     //[mir]~^ HELP make this binding mutable
7     //[mir]~| SUGGESTION mut v
8     v = 1; //[ast]~ NOTE first assignment
9            //[mir]~^ NOTE first assignment
10     println!("v={}", v);
11     v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
12            //[mir]~^ ERROR cannot assign twice to immutable variable `v`
13            //[ast]~| NOTE cannot assign twice to immutable
14            //[mir]~| NOTE cannot assign twice to immutable
15     println!("v={}", v);
16 }
17
18 fn main() {
19 }