rust/src/test/ui/assign-imm-local-twice.rs
2019-04-22 08:40:08 +01:00

14 lines
317 B
Rust

fn test() {
let v: isize;
//~^ HELP make this binding mutable
//~| SUGGESTION mut v
v = 1; //~ NOTE first assignment
println!("v={}", v);
v = 2; //~ ERROR cannot assign twice to immutable variable
//~| NOTE cannot assign twice to immutable
println!("v={}", v);
}
fn main() {
}