]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/issue-41110.rs
Fix ABI, run and fix more tests, re-enable CI for PRs
[rust.git] / src / test / mir-opt / issue-41110.rs
1 // ignore-emscripten compiled with panic=abort by default
2
3 // check that we don't emit multiple drop flags when they are not needed.
4
5 fn main() {
6     let x = S.other(S.id());
7 }
8
9 // no_mangle to make sure this gets instantiated even in an executable.
10 #[no_mangle]
11 pub fn test() {
12     let u = S;
13     let mut v = S;
14     drop(v);
15     v = u;
16 }
17
18 struct S;
19 impl Drop for S {
20     fn drop(&mut self) {
21     }
22 }
23
24 impl S {
25     fn id(self) -> Self { self }
26     fn other(self, s: Self) {}
27 }
28
29 // END RUST SOURCE
30 // START rustc.main.ElaborateDrops.after.mir
31 //    let mut _0: ();
32 //    let _1: ();
33 //    let mut _2: S;
34 //    let mut _3: S;
35 //    let mut _4: S;
36 //    let mut _5: bool;
37 //    scope 1 {
38 //    }
39 //    ...
40 //    bb0: {
41 // END rustc.main.ElaborateDrops.after.mir
42 // START rustc.test.ElaborateDrops.after.mir
43 //    let mut _0: ();
44 //    let _1: S;
45 //    let _3: ();
46 //    let mut _4: S;
47 //    let mut _5: S;
48 //    let mut _6: bool;
49 //    ...
50 //    let mut _2: S;
51 //    ...
52 //    bb0: {
53 // END rustc.test.ElaborateDrops.after.mir