1 // Regression test for #31567: cached results of projections were
2 // causing region relations not to be enforced at all the places where
3 // they have to be enforced.
5 struct VecWrapper<'a>(&'a mut S);
9 fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
10 let s_inner: &'a S = &*v.0; //~ ERROR borrow may still be in use when destructor runs [E0713]
14 impl<'a> Drop for VecWrapper<'a> {
16 *self.0 = S(Box::new(0));
21 let mut s = S(Box::new(11));
22 let vw = VecWrapper(&mut s);
23 let dangling = get_dangling(vw);
24 println!("{}", dangling);