]> git.proxmox.com Git - rustc.git/blob - src/test/mir-opt/nll/region-subtyping-basic.rs
New upstream version 1.44.1+dfsg1
[rustc.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 // EMIT_MIR_FOR_EACH_BIT_WIDTH
13 // EMIT_MIR rustc.main.nll.0.mir
14 fn main() {
15 let mut v = [1, 2, 3];
16 let p = &v[0];
17 let q = p;
18 if true {
19 use_x(*q);
20 } else {
21 use_x(22);
22 }
23 }