]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/stacked_borrows/drop_in_place_retag.rs
Retag as FnEntry on `drop_in_place`
[rust.git] / src / tools / miri / tests / fail / stacked_borrows / drop_in_place_retag.rs
1 //! Test that drop_in_place mutably retags the entire place,
2 //! ensuring it is writeable
3
4 //@error-pattern: /retag .* for Unique permission .* only grants SharedReadOnly permission/
5
6 #[repr(transparent)]
7 struct HasDrop;
8
9 impl Drop for HasDrop {
10     fn drop(&mut self) {}
11 }
12
13 fn main() {
14     unsafe {
15         let x = (0u8, HasDrop);
16         let x = core::ptr::addr_of!(x);
17         core::ptr::drop_in_place(x.cast_mut());
18     }
19 }