rust/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs

8 lines
211 B
Rust

fn main() {
let mut b = ~3;
let _x = &mut *b; //~ NOTE loan of mutable local variable granted here
let mut y = /*move*/ b; //~ ERROR moving out of mutable local variable prohibited
*y += 1;
}