]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/loop_test.rs
Render const pointers in MIR more compactly
[rust.git] / src / test / mir-opt / loop_test.rs
1 // compile-flags: -Z identify_regions
2
3 // Tests to make sure we correctly generate falseUnwind edges in loops
4
5 fn main() {
6     // Exit early at runtime. Since only care about the generated MIR
7     // and not the runtime behavior (which is exercised by other tests)
8     // we just bail early. Without this the test just loops infinitely.
9     if true {
10         return;
11     }
12     loop {
13         let x = 1;
14         continue;
15     }
16 }
17
18 // END RUST SOURCE
19 // START rustc.main.SimplifyCfg-qualify-consts.after.mir
20 //    ...
21 //    bb1 (cleanup): {
22 //        resume;
23 //    }
24 //    ...
25 //    bb3: { // Entry into the loop
26 //        _1 = ();
27 //        StorageDead(_2);
28 //        StorageDead(_1);
29 //        StorageLive(_4);
30 //        goto -> bb5;
31 //    }
32 //    ...
33 //    bb5: { // The loop_block
34 //        falseUnwind -> [real: bb6, cleanup: bb1];
35 //    }
36 //    bb6: { // The loop body (body_block)
37 //        StorageLive(_6);
38 //        _6 = const 1i32;
39 //        FakeRead(ForLet, _6);
40 //        StorageDead(_6);
41 //        goto -> bb5;
42 //    }
43 //    ...
44 // END rustc.main.SimplifyCfg-qualify-consts.after.mir