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.
5 // compile-flags:-Zborrowck=mir
9 #![feature(dropck_eyepatch)]
11 fn use_x(_: usize) -> bool { true }
14 let mut v = [1, 2, 3];
15 let p: WrapMayDangle<& /* R4 */ usize> = WrapMayDangle { value: &v[0] };
17 // `p` will get dropped at end of this block. However, because of
18 // the `#[may_dangle]` attribute, we do not need to consider R4
19 // live after this point.
29 struct WrapMayDangle<T> {
33 unsafe impl<#[may_dangle] T> Drop for WrapMayDangle<T> {
34 fn drop(&mut self) { }