1 struct A { a: isize, b: Box<isize> }
5 fn deref_after_move() {
6 let x = A { a: 1, b: Box::new(2) };
8 drop(*x.b); //~ ERROR use of moved value: `x.b`
11 fn deref_after_fu_move() {
12 let x = A { a: 1, b: Box::new(2) };
13 let y = A { a: 3, .. x };
14 drop(*x.b); //~ ERROR use of moved value: `x.b`
17 fn borrow_after_move() {
18 let x = A { a: 1, b: Box::new(2) };
20 let p = &x.b; //~ ERROR borrow of moved value: `x.b`
24 fn borrow_after_fu_move() {
25 let x = A { a: 1, b: Box::new(2) };
26 let _y = A { a: 3, .. x };
27 let p = &x.b; //~ ERROR borrow of moved value: `x.b`
31 fn move_after_borrow() {
32 let x = A { a: 1, b: Box::new(2) };
34 drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed
38 fn fu_move_after_borrow() {
39 let x = A { a: 1, b: Box::new(2) };
41 let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed
45 fn mut_borrow_after_mut_borrow() {
46 let mut x = A { a: 1, b: Box::new(2) };
48 let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time
53 fn move_after_move() {
54 let x = A { a: 1, b: Box::new(2) };
56 drop(x.b); //~ ERROR use of moved value: `x.b`
59 fn move_after_fu_move() {
60 let x = A { a: 1, b: Box::new(2) };
61 let _y = A { a: 3, .. x };
62 drop(x.b); //~ ERROR use of moved value: `x.b`
65 fn fu_move_after_move() {
66 let x = A { a: 1, b: Box::new(2) };
68 let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b`
71 fn fu_move_after_fu_move() {
72 let x = A { a: 1, b: Box::new(2) };
73 let _y = A { a: 3, .. x };
74 let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b`
77 // The following functions aren't yet accepted, but they should be.
79 fn copy_after_field_assign_after_uninit() {
81 x.a = 1; //~ ERROR assign to part of possibly-uninitialized variable: `x`
85 fn borrow_after_field_assign_after_uninit() {
87 x.a = 1; //~ ERROR assign to part of possibly-uninitialized variable: `x`
92 fn move_after_field_assign_after_uninit() {
94 x.b = Box::new(1); //~ ERROR assign to part of possibly-uninitialized variable: `x`
100 deref_after_fu_move();
103 borrow_after_fu_move();
105 fu_move_after_borrow();
106 mut_borrow_after_mut_borrow();
109 move_after_fu_move();
110 fu_move_after_move();
111 fu_move_after_fu_move();
113 copy_after_field_assign_after_uninit();
114 borrow_after_field_assign_after_uninit();
115 move_after_field_assign_after_uninit();