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