]>
Commit | Line | Data |
---|---|---|
3b2f2976 XL |
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 | ||
ff7c6d11 XL |
11 | // ignore-wasm32-bare compiled with panic=abort by default |
12 | ||
3b2f2976 XL |
13 | #![feature(box_syntax)] |
14 | ||
15 | fn main() { | |
16 | let x = box S::new(); | |
17 | drop(x); | |
18 | } | |
19 | ||
20 | struct S; | |
21 | ||
22 | impl S { | |
23 | fn new() -> Self { S } | |
24 | } | |
25 | ||
26 | impl Drop for S { | |
27 | fn drop(&mut self) { | |
28 | println!("splat!"); | |
29 | } | |
30 | } | |
31 | ||
32 | // END RUST SOURCE | |
abe05a73 | 33 | // START rustc.main.ElaborateDrops.before.mir |
3b2f2976 | 34 | // let mut _0: (); |
abe05a73 XL |
35 | // scope 1 { |
36 | // let _1: std::boxed::Box<S>; | |
37 | // } | |
38 | // ... | |
3b2f2976 XL |
39 | // let mut _2: std::boxed::Box<S>; |
40 | // let mut _3: (); | |
41 | // let mut _4: std::boxed::Box<S>; | |
42 | // | |
43 | // bb0: { | |
44 | // StorageLive(_1); | |
45 | // StorageLive(_2); | |
46 | // _2 = Box(S); | |
ff7c6d11 | 47 | // (*_2) = const S::new() -> [return: bb2, unwind: bb3]; |
3b2f2976 XL |
48 | // } |
49 | // | |
50 | // bb1: { | |
ff7c6d11 | 51 | // resume; |
3b2f2976 XL |
52 | // } |
53 | // | |
54 | // bb2: { | |
ff7c6d11 XL |
55 | // _1 = move _2; |
56 | // drop(_2) -> bb4; | |
3b2f2976 XL |
57 | // } |
58 | // | |
59 | // bb3: { | |
ff7c6d11 | 60 | // drop(_2) -> bb1; |
3b2f2976 XL |
61 | // } |
62 | // | |
63 | // bb4: { | |
64 | // StorageDead(_2); | |
65 | // StorageLive(_4); | |
ff7c6d11 XL |
66 | // _4 = move _1; |
67 | // _3 = const std::mem::drop(move _4) -> [return: bb5, unwind: bb7]; | |
3b2f2976 XL |
68 | // } |
69 | // | |
70 | // bb5: { | |
71 | // drop(_4) -> [return: bb8, unwind: bb6]; | |
72 | // } | |
73 | // | |
74 | // bb6: { | |
ff7c6d11 | 75 | // drop(_1) -> bb1; |
3b2f2976 XL |
76 | // } |
77 | // | |
78 | // bb7: { | |
79 | // drop(_4) -> bb6; | |
80 | // } | |
81 | // | |
82 | // bb8: { | |
83 | // StorageDead(_4); | |
84 | // _0 = (); | |
85 | // drop(_1) -> bb9; | |
86 | // } | |
87 | // | |
88 | // bb9: { | |
89 | // StorageDead(_1); | |
90 | // return; | |
91 | // } | |
92 | // } | |
abe05a73 | 93 | // END rustc.main.ElaborateDrops.before.mir |