]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/issue-49232.rs
Rollup merge of #54046 - snaedis:issue-48022, r=steveklabnik
[rust.git] / src / test / mir-opt / issue-49232.rs
1 // Copyright 2018 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 // We must mark a variable whose initialization fails due to an
12 // abort statement as StorageDead.
13
14 fn main() {
15     loop {
16         let beacon = {
17             match true {
18                 false => 4,
19                 true => break,
20             }
21         };
22         drop(&beacon);
23     }
24 }
25
26 // END RUST SOURCE
27 // START rustc.main.mir_map.0.mir
28 // fn main() -> (){
29 //     let mut _0: ();
30 //     scope 1 {
31 //     }
32 //     scope 2 {
33 //         let _2: i32;
34 //     }
35 //     let mut _1: ();
36 //     let mut _3: bool;
37 //     let mut _4: u8;
38 //     let mut _5: !;
39 //     let mut _6: ();
40 //     let mut _7: &i32;
41 //     bb0: {
42 //         goto -> bb1;
43 //     }
44 //     bb1: {
45 //         falseUnwind -> [real: bb3, cleanup: bb4];
46 //     }
47 //     bb2: {
48 //         goto -> bb29;
49 //     }
50 //     bb3: {
51 //         StorageLive(_2);
52 //         StorageLive(_3);
53 //         _3 = const true;
54 //         _4 = discriminant(_3);
55 //         switchInt(_3) -> [false: bb11, otherwise: bb10];
56 //     }
57 //     bb4: {
58 //         resume;
59 //     }
60 //     bb5: {
61 //         _2 = const 4i32;
62 //         goto -> bb14;
63 //     }
64 //     bb6: {
65 //         _0 = ();
66 //         goto -> bb15;
67 //     }
68 //     bb7: {
69 //         falseEdges -> [real: bb12, imaginary: bb8];
70 //     }
71 //     bb8: {
72 //         falseEdges -> [real: bb13, imaginary: bb9];
73 //     }
74 //     bb9: {
75 //         unreachable;
76 //     }
77 //     bb10: {
78 //         goto -> bb8;
79 //     }
80 //     bb11: {
81 //         goto -> bb7;
82 //     }
83 //     bb12: {
84 //         goto -> bb5;
85 //     }
86 //     bb13: {
87 //         goto -> bb6;
88 //     }
89 //     bb14: {
90 //         StorageDead(_3);
91 //         StorageLive(_7);
92 //         _7 = &_2;
93 //         _6 = const std::mem::drop(move _7) -> [return: bb28, unwind: bb4];
94 //     }
95 //     bb15: {
96 //         goto -> bb16;
97 //     }
98 //     bb16: {
99 //         goto -> bb17;
100 //     }
101 //     bb17: {
102 //         goto -> bb18;
103 //     }
104 //     bb18: {
105 //         goto -> bb19;
106 //     }
107 //     bb19: {
108 //         goto -> bb20;
109 //     }
110 //     bb20: {
111 //         StorageDead(_3);
112 //         goto -> bb21;
113 //     }
114 //     bb21: {
115 //         goto -> bb22;
116 //     }
117 //     bb22: {
118 //         StorageDead(_2);
119 //         goto -> bb23;
120 //     }
121 //     bb23: {
122 //         goto -> bb24;
123 //     }
124 //     bb24: {
125 //         goto -> bb25;
126 //     }
127 //     bb25: {
128 //         goto -> bb2;
129 //     }
130 //     bb26: {
131 //         _5 = ();
132 //         unreachable;
133 //     }
134 //     bb27: {
135 //         StorageDead(_5);
136 //         goto -> bb14;
137 //     }
138 //     bb28: {
139 //         StorageDead(_7);
140 //         _1 = ();
141 //         StorageDead(_2);
142 //         goto -> bb1;
143 //     }
144 //     bb29: {
145 //         return;
146 //     }
147 // }
148 // END rustc.main.mir_map.0.mir