]> git.proxmox.com Git - rustc.git/blob - src/test/mir-opt/nll/region-subtyping-basic.rs
New upstream version 1.66.0+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:-Zverbose
6 // ^^^^^^^^^ force compiler to dump more region information
7
8 #![allow(warnings)]
9
10 fn use_x(_: usize) -> bool {
11 true
12 }
13
14 // EMIT_MIR_FOR_EACH_BIT_WIDTH
15 // EMIT_MIR region_subtyping_basic.main.nll.0.mir
16 fn main() {
17 let mut v = [1, 2, 3];
18 let p = &v[0];
19 let q = p;
20 if true {
21 use_x(*q);
22 } else {
23 use_x(22);
24 }
25 }