]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/packed-struct-drop-aligned.rs
Auto merge of #46393 - kennytm:45861-step-2-3-make-tools-job-not-fail-fast, r=alexcri...
[rust.git] / src / test / mir-opt / packed-struct-drop-aligned.rs
1 // Copyright 2017 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.
4 //
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.
10
11 // ignore-wasm32-bare compiled with panic=abort by default
12
13 fn main() {
14     let mut x = Packed(Aligned(Droppy(0)));
15     x.0 = Aligned(Droppy(0));
16 }
17
18 struct Aligned(Droppy);
19 #[repr(packed)]
20 struct Packed(Aligned);
21
22 struct Droppy(usize);
23 impl Drop for Droppy {
24     fn drop(&mut self) {}
25 }
26
27 // END RUST SOURCE
28 // START rustc.main.EraseRegions.before.mir
29 // fn main() -> () {
30 //     let mut _0: ();
31 //     scope 1 {
32 //         let mut _1: Packed;
33 //     }
34 //     scope 2 {
35 //     }
36 //     let mut _2: Aligned;
37 //     let mut _3: Droppy;
38 //     let mut _4: Aligned;
39 //     let mut _5: Droppy;
40 //     let mut _6: Aligned;
41 //
42 //     bb0: {
43 //         StorageLive(_1);
44 //         ...
45 //         _1 = Packed::{{constructor}}(move _2,);
46 //         ...
47 //         StorageLive(_6);
48 //         _6 = move (_1.0: Aligned);
49 //         drop(_6) -> [return: bb4, unwind: bb3];
50 //     }
51 //     bb1: {
52 //         resume;
53 //     }
54 //     bb2: {
55 //         StorageDead(_1);
56 //         return;
57 //     }
58 //     bb3: {
59 //         (_1.0: Aligned) = move _4;
60 //         drop(_1) -> bb1;
61 //     }
62 //     bb4: {
63 //         StorageDead(_6);
64 //         (_1.0: Aligned) = move _4;
65 //         StorageDead(_4);
66 //         _0 = ();
67 //         drop(_1) -> [return: bb2, unwind: bb1];
68 //     }
69 // }
70 // END rustc.main.EraseRegions.before.mir