]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/end_region_3.rs
change MIR dump filenames from `nodeN` to `DefPath`
[rust.git] / src / test / mir-opt / end_region_3.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 // compile-flags: -Z identify_regions -Z emit-end-regions
12 // ignore-tidy-linelength
13
14 // Binding the borrow's subject outside the loop does not increase the
15 // scope of the borrow.
16
17 fn main() {
18     let mut a;
19     loop {
20         a = true;
21         let b = &a;
22         if a { break; }
23         let c = &a;
24     }
25 }
26
27 // END RUST SOURCE
28 // START rustc.main.SimplifyCfg-qualify-consts.after.mir
29 //     let mut _0: ();
30 //     ...
31 //     let mut _1: bool;
32 //     ...
33 //     let _3: &'26_1rs bool;
34 //     ...
35 //     let _7: &'26_3rs bool;
36 //     ...
37 //     let mut _2: ();
38 //     let mut _4: ();
39 //     let mut _5: bool;
40 //     let mut _6: !;
41 //     bb0: {
42 //         StorageLive(_1);
43 //         goto -> bb1;
44 //     }
45 //     bb1: {
46 //         _1 = const true;
47 //         StorageLive(_3);
48 //         _3 = &'26_1rs _1;
49 //         StorageLive(_5);
50 //         _5 = _1;
51 //         switchInt(_5) -> [0u8: bb3, otherwise: bb2];
52 //     }
53 //     bb2: {
54 //         _0 = ();
55 //         StorageDead(_5);
56 //         EndRegion('26_1rs);
57 //         StorageDead(_3);
58 //         StorageDead(_1);
59 //         return;
60 //     }
61 //     bb3: {
62 //         _4 = ();
63 //         StorageDead(_5);
64 //         StorageLive(_7);
65 //         _7 = &'26_3rs _1;
66 //         _2 = ();
67 //         EndRegion('26_3rs);
68 //         StorageDead(_7);
69 //         EndRegion('26_1rs);
70 //         StorageDead(_3);
71 //         goto -> bb1;
72 //     }
73 // END rustc.main.SimplifyCfg-qualify-consts.after.mir