From 1bf4f030dc6f035cd703069a4cb5cdd0a4c71022 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 30 May 2024 09:07:06 +0200 Subject: [PATCH] explain what the open questions are, and add a Miri test for that --- tests/pass/drop_in_place.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/pass/drop_in_place.rs diff --git a/tests/pass/drop_in_place.rs b/tests/pass/drop_in_place.rs new file mode 100644 index 0000000000..0615a43c80 --- /dev/null +++ b/tests/pass/drop_in_place.rs @@ -0,0 +1,12 @@ +// Miri currently doesn't require types without drop glue to be +// valid when dropped. This test confirms that behavior. +// This is not a stable guarantee! + +use std::ptr; + +fn main() { + let mut not_a_bool = 13u8; + unsafe { + ptr::drop_in_place(&mut not_a_bool as *mut u8 as *mut bool) + }; +}