]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/nll/liveness-drop-intra-block.rs
Auto merge of #46393 - kennytm:45861-step-2-3-make-tools-job-not-fail-fast, r=alexcri...
[rust.git] / src / test / mir-opt / nll / liveness-drop-intra-block.rs
1 // Copyright 2012-2016 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:-Znll
12
13 #![allow(warnings)]
14
15 fn use_x(_: usize) -> bool { true }
16
17 fn main() {
18     let mut x = 22;
19     loop {
20         // Key point: `x` not live on entry to this basic block.
21         x = 55;
22         if use_x(x) { break; }
23     }
24 }
25
26 // END RUST SOURCE
27 // START rustc.main.nll.0.mir
28 //    | Live variables on entry to bb2: []
29 //    bb2: {
30 //            | Live variables at bb2[0]: []
31 //        _1 = const 55usize;
32 //            | Live variables at bb2[1]: [_1]
33 //        StorageLive(_3);
34 //            | Live variables at bb2[2]: [_1]
35 //        StorageLive(_4);
36 //            | Live variables at bb2[3]: [_1]
37 //        _4 = _1;
38 //            | Live variables at bb2[4]: [_4]
39 //        _3 = const use_x(move _4) -> [return: bb3, unwind: bb1];
40 //    }
41 // END rustc.main.nll.0.mir