]> git.proxmox.com Git - rustc.git/blame - 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
CommitLineData
abe05a73
XL
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
83c7162d
XL
5// compile-flags:-Zborrowck=mir -Zverbose
6// ^^^^^^^^^ force compiler to dump more region information
abe05a73
XL
7
8#![allow(warnings)]
9
10fn use_x(_: usize) -> bool { true }
11
ba9703b0
XL
12// EMIT_MIR_FOR_EACH_BIT_WIDTH
13// EMIT_MIR rustc.main.nll.0.mir
abe05a73
XL
14fn 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}