rust/src/test/compile-fail/assign-imm-local-twice.rs

10 lines
177 B
Rust
Raw Normal View History

fn test(cond: bool) {
let v: int;
v = 1; //! NOTE prior assignment occurs here
v = 2; //! ERROR re-assignment of immutable variable
}
fn main() {
test(true);
}