1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // pretty-expanded FIXME #23616
13 #![feature(box_syntax)]
15 struct A { a: isize, b: Box<isize> }
16 struct B { a: Box<isize>, b: Box<isize> }
18 fn move_after_copy() {
19 let x = A { a: 1, b: box 2 };
24 fn move_after_fu_copy() {
25 let x = A { a: 1, b: box 2 };
26 let _y = A { b: box 3, .. x };
30 fn fu_move_after_copy() {
31 let x = A { a: 1, b: box 2 };
33 let _y = A { a: 3, .. x };
36 fn fu_move_after_fu_copy() {
37 let x = A { a: 1, b: box 2 };
38 let _y = A { b: box 3, .. x };
39 let _z = A { a: 4, .. x };
42 fn copy_after_move() {
43 let x = A { a: 1, b: box 2 };
48 fn copy_after_fu_move() {
49 let x = A { a: 1, b: box 2 };
50 let y = A { a: 3, .. x };
54 fn fu_copy_after_move() {
55 let x = A { a: 1, b: box 2 };
57 let _y = A { b: box 3, .. x };
60 fn fu_copy_after_fu_move() {
61 let x = A { a: 1, b: box 2 };
62 let _y = A { a: 3, .. x };
63 let _z = A { b: box 3, .. x };
66 fn borrow_after_move() {
67 let x = A { a: 1, b: box 2 };
73 fn borrow_after_fu_move() {
74 let x = A { a: 1, b: box 2 };
75 let _y = A { a: 3, .. x };
80 fn move_after_borrow() {
81 let x = A { a: 1, b: box 2 };
87 fn fu_move_after_borrow() {
88 let x = A { a: 1, b: box 2 };
90 let _y = A { a: 3, .. x };
94 fn mut_borrow_after_mut_borrow() {
95 let mut x = A { a: 1, b: box 2 };
102 fn move_after_move() {
103 let x = B { a: box 1, b: box 2 };
108 fn move_after_fu_move() {
109 let x = B { a: box 1, b: box 2 };
110 let y = B { a: box 3, .. x };
114 fn fu_move_after_move() {
115 let x = B { a: box 1, b: box 2 };
117 let z = B { a: box 3, .. x };
121 fn fu_move_after_fu_move() {
122 let x = B { a: box 1, b: box 2 };
123 let _y = B { b: box 3, .. x };
124 let _z = B { a: box 4, .. x };
127 fn copy_after_assign_after_move() {
128 let mut x = A { a: 1, b: box 2 };
130 x = A { a: 3, b: box 4 };
134 fn copy_after_assign_after_fu_move() {
135 let mut x = A { a: 1, b: box 2 };
136 let _y = A { a: 3, .. x };
137 x = A { a: 3, b: box 4 };
141 fn copy_after_field_assign_after_move() {
142 let mut x = A { a: 1, b: box 2 };
148 fn copy_after_field_assign_after_fu_move() {
149 let mut x = A { a: 1, b: box 2 };
150 let _y = A { a: 3, .. x };
155 fn borrow_after_assign_after_move() {
156 let mut x = A { a: 1, b: box 2 };
158 x = A { a: 3, b: box 4 };
163 fn borrow_after_assign_after_fu_move() {
164 let mut x = A { a: 1, b: box 2 };
165 let _y = A { a: 3, .. x };
166 x = A { a: 3, b: box 4 };
171 fn borrow_after_field_assign_after_move() {
172 let mut x = A { a: 1, b: box 2 };
179 fn borrow_after_field_assign_after_fu_move() {
180 let mut x = A { a: 1, b: box 2 };
181 let _y = A { a: 3, .. x };
187 fn move_after_assign_after_move() {
188 let mut x = A { a: 1, b: box 2 };
190 x = A { a: 3, b: box 4 };
194 fn move_after_assign_after_fu_move() {
195 let mut x = A { a: 1, b: box 2 };
196 let _y = A { a: 3, .. x };
197 x = A { a: 3, b: box 4 };
201 fn move_after_field_assign_after_move() {
202 let mut x = A { a: 1, b: box 2 };
208 fn move_after_field_assign_after_fu_move() {
209 let mut x = A { a: 1, b: box 2 };
210 let _y = A { a: 3, .. x };
215 fn copy_after_assign_after_uninit() {
217 x = A { a: 1, b: box 2 };
221 fn borrow_after_assign_after_uninit() {
223 x = A { a: 1, b: box 2 };
228 fn move_after_assign_after_uninit() {
230 x = A { a: 1, b: box 2 };
236 move_after_fu_copy();
237 fu_move_after_copy();
238 fu_move_after_fu_copy();
240 copy_after_fu_move();
241 fu_copy_after_move();
242 fu_copy_after_fu_move();
245 borrow_after_fu_move();
247 fu_move_after_borrow();
248 mut_borrow_after_mut_borrow();
251 move_after_fu_move();
252 fu_move_after_move();
253 fu_move_after_fu_move();
255 copy_after_assign_after_move();
256 copy_after_assign_after_fu_move();
257 copy_after_field_assign_after_move();
258 copy_after_field_assign_after_fu_move();
260 borrow_after_assign_after_move();
261 borrow_after_assign_after_fu_move();
262 borrow_after_field_assign_after_move();
263 borrow_after_field_assign_after_fu_move();
265 move_after_assign_after_move();
266 move_after_assign_after_fu_move();
267 move_after_field_assign_after_move();
268 move_after_field_assign_after_fu_move();
270 copy_after_assign_after_uninit();
271 borrow_after_assign_after_uninit();
272 move_after_assign_after_uninit();