]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/nll/region-subtyping-basic.rs
Auto merge of #69265 - ehuss:update-cargo, r=Dylan-DPC
[rust.git] / src / test / mir-opt / nll / region-subtyping-basic.rs
1 // Basic test for liveness constraints: the region (`R1`) that appears
2 // in the type of `p` includes the points after `&v[0]` up to (but not
3 // including) the call to `use_x`. The `else` branch is not included.
4
5 // compile-flags:-Zborrowck=mir -Zverbose
6 //                              ^^^^^^^^^ force compiler to dump more region information
7
8 #![allow(warnings)]
9
10 fn use_x(_: usize) -> bool { true }
11
12 fn main() {
13     let mut v = [1, 2, 3];
14     let p = &v[0];
15     let q = p;
16     if true {
17         use_x(*q);
18     } else {
19         use_x(22);
20     }
21 }
22
23 // END RUST SOURCE
24 // START rustc.main.nll.0.mir
25 // | '_#2r | U0 | {bb2[0..=8], bb3[0], bb5[0..=2]}
26 // | '_#3r | U0 | {bb2[1..=8], bb3[0], bb5[0..=2]}
27 // | '_#4r | U0 | {bb2[4..=8], bb3[0], bb5[0..=2]}
28 // END rustc.main.nll.0.mir
29 // START rustc.main.nll.0.mir
30 // let _2: &'_#3r usize;
31 // ...
32 // debug p => _2;
33 // ...
34 // let _6: &'_#4r usize;
35 // ...
36 // debug q => _6;
37 // ...
38 // _2 = &'_#2r _1[_3];
39 // ...
40 // _6 = _2;
41 // END rustc.main.nll.0.mir