]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/while-storage.rs
Auto merge of #61459 - GuillaumeGomez:fix-rustdoc-sysroot-panic, r=ollie27,bjorn3...
[rust.git] / src / test / mir-opt / while-storage.rs
1 // Test that we correctly generate StorageDead statements for while loop
2 // conditions on all branches
3
4 fn get_bool(c: bool) -> bool {
5     c
6 }
7
8 fn while_loop(c: bool) {
9     while get_bool(c) {
10         if get_bool(c) {
11             break;
12         }
13     }
14 }
15
16 fn main() {
17     while_loop(false);
18 }
19
20 // END RUST SOURCE
21
22 // START rustc.while_loop.PreCodegen.after.mir
23 // bb0: {
24 //     StorageLive(_2);
25 //     StorageLive(_3);
26 //     _3 = _1;
27 //     _2 = const get_bool(move _3) -> bb2;
28 // }
29 // bb1: {
30 //     return;
31 // }
32 // bb2: {
33 //     StorageDead(_3);
34 //     switchInt(move _2) -> [false: bb4, otherwise: bb3];
35 // }
36 // bb3: {
37 //     StorageDead(_2);
38 //     StorageLive(_4);
39 //     StorageLive(_5);
40 //     _5 = _1;
41 //     _4 = const get_bool(move _5) -> bb5;
42 // }
43 // bb4: {
44 //     StorageDead(_2);
45 //     goto -> bb1;
46 // }
47 // bb5: {
48 //     StorageDead(_5);
49 //     switchInt(_4) -> [false: bb6, otherwise: bb7];
50 // }
51 // bb6: {
52 //     StorageDead(_4);
53 //     goto -> bb0;
54 // }
55 // bb7: {
56 //     StorageDead(_4);
57 //     goto -> bb1;
58 // }
59 // END rustc.while_loop.PreCodegen.after.mir