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.
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.
11 // Basic test for liveness constraints: the region (`R1`) that appears
12 // in the type of `p` includes the points after `&v[0]` up to (but not
13 // including) the call to `use_x`. The `else` branch is not included.
15 // compile-flags:-Znll -Zverbose
16 // ^^^^^^^^^ force compiler to dump more region information
20 fn use_x(_: usize) -> bool { true }
23 let mut v = [1, 2, 3];
33 // START rustc.main.nll.0.mir
34 // | '_#1r: {bb1[1], bb2[0], bb2[1]}
35 // | '_#2r: {bb1[1], bb2[0], bb2[1]}
37 // let _2: &'_#2r usize;
38 // END rustc.main.nll.0.mir
39 // START rustc.main.nll.0.mir
41 // | Live variables at bb1[0]: [_1, _3]
42 // _2 = &'_#1r _1[_3];
43 // | Live variables at bb1[1]: [_2]
44 // switchInt(const true) -> [0u8: bb3, otherwise: bb2];
46 // END rustc.main.nll.0.mir
47 // START rustc.main.nll.0.mir
49 // | Live variables at bb2[0]: [_2]
51 // | Live variables at bb2[1]: [_2]
53 // | Live variables at bb2[2]: [_7]
54 // _6 = const use_x(move _7) -> bb4;
56 // END rustc.main.nll.0.mir