]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/issue-38669.rs
Rollup merge of #53545 - FelixMcFelix:fix-50865-beta, r=petrochenkov
[rust.git] / src / test / mir-opt / issue-38669.rs
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
11 // check that we don't StorageDead booleans before they are used
12
13 fn main() {
14     let mut should_break = false;
15     loop {
16         if should_break {
17             break;
18         }
19         should_break = true;
20     }
21 }
22
23 // END RUST SOURCE
24 // START rustc.main.SimplifyCfg-initial.after.mir
25 //     bb0: {
26 //         StorageLive(_1);
27 //         _1 = const false;
28 //         goto -> bb2;
29 //     }
30 //     bb1: {
31 //         resume;
32 //     }
33 //     bb2: {
34 //         falseUnwind -> [real: bb3, cleanup: bb1];
35 //     }
36 //     bb3: {
37 //         StorageLive(_4);
38 //         _4 = _1;
39 //         switchInt(move _4) -> [false: bb5, otherwise: bb4];
40 //     }
41 //     bb4: {
42 //         _0 = ();
43 //         StorageDead(_4);
44 //         StorageDead(_1);
45 //         return;
46 //     }
47 //     bb5: {
48 //         _3 = ();
49 //         StorageDead(_4);
50 //         _1 = const true;
51 //         _2 = ();
52 //         goto -> bb2;
53 //     }
54 // END rustc.main.SimplifyCfg-initial.after.mir