1 //@error-pattern: /deallocation .* tag does not exist in the borrow stack/
2 use std::alloc::{alloc, dealloc, Layout};
6 let x = alloc(Layout::from_size_align_unchecked(1, 1));
7 let ptr1 = (&mut *x) as *mut u8;
8 let ptr2 = (&mut *ptr1) as *mut u8;
9 // Invalidate ptr2 by writing to ptr1.
11 // Deallocate through ptr2.
12 dealloc(ptr2, Layout::from_size_align_unchecked(1, 1));