rust/tests/mir-opt/nll/region_subtyping_basic.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
604 B
Rust
Raw Normal View History

2017-10-25 17:04:57 -05:00
// Basic test for liveness constraints: the region (`R1`) that appears
// in the type of `p` includes the points after `&v[0]` up to (but not
// including) the call to `use_x`. The `else` branch is not included.
2022-04-01 12:13:25 -05:00
// compile-flags:-Zverbose
// ^^^^^^^^^ force compiler to dump more region information
2017-10-25 17:04:57 -05:00
#![allow(warnings)]
2020-04-09 05:55:27 -05:00
fn use_x(_: usize) -> bool {
true
}
2017-10-25 17:04:57 -05:00
// EMIT_MIR_FOR_EACH_BIT_WIDTH
2020-07-27 14:22:43 -05:00
// EMIT_MIR region_subtyping_basic.main.nll.0.mir
2017-10-25 17:04:57 -05:00
fn main() {
let mut v = [1, 2, 3];
let p = &v[0];
let q = p;
if true {
use_x(*q);
} else {
use_x(22);
}
}