1 // Test that move restrictions are enforced on overloaded unary operations
5 fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) {
8 x.clone(); //~ ERROR: borrow of moved value
11 fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
15 !x; //~ ERROR: cannot move out of `x` because it is borrowed
17 !y; //~ ERROR: cannot move out of `y` because it is borrowed
18 use_mut(n); use_imm(m);
20 fn illegal_dereference<T: Not<Output=T>>(mut x: T, y: T) {
24 !*m; //~ ERROR: cannot move out of `*m`
26 !*n; //~ ERROR: cannot move out of `*n`
27 use_imm(n); use_mut(m);
31 fn use_mut<T>(_: &mut T) { }
32 fn use_imm<T>(_: &T) { }