rust/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs

10 lines
179 B
Rust
Raw Normal View History

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