2017-10-25 22:04:57 +00: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 17:13:25 +00:00
|
|
|
// compile-flags:-Zverbose
|
|
|
|
// ^^^^^^^^^ force compiler to dump more region information
|
2017-10-25 22:04:57 +00:00
|
|
|
|
|
|
|
#![allow(warnings)]
|
|
|
|
|
2020-04-09 10:55:27 +00:00
|
|
|
fn use_x(_: usize) -> bool {
|
|
|
|
true
|
|
|
|
}
|
2017-10-25 22:04:57 +00:00
|
|
|
|
2020-04-04 20:25:54 +00:00
|
|
|
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
2020-07-27 19:22:43 +00:00
|
|
|
// EMIT_MIR region_subtyping_basic.main.nll.0.mir
|
2017-10-25 22:04:57 +00: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);
|
|
|
|
}
|
|
|
|
}
|