rust/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs

7 lines
156 B
Rust
Raw Normal View History

2012-05-10 21:58:23 -05:00
fn main() {
let x: int = 3;
let y: &mut int = &mut x; //! ERROR taking mut reference to immutable local variable
*y = 5;
log (debug, *y);
}