diff options
| author | bors <bors@rust-lang.org> | 2024-04-18 08:25:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-18 08:25:06 +0000 |
| commit | 0f44382bcab53efb86ac9d9bf991e69755b1b390 (patch) | |
| tree | 26b8d4c2e787ef3dc444abe7fc97b8f67bbdf743 | |
| parent | d261b5308111fa95427fcfdfd53a8331dd44a2b6 (diff) | |
| parent | 5c352a4e7571d09a2cc5fe9c5bc86b02d62b49d8 (diff) | |
Auto merge of #3483 - RalfJung:drop, r=RalfJung
add test for Drop terminator on non-drop type Fixes https://github.com/rust-lang/miri/issues/2737
| -rw-r--r-- | src/tools/miri/tests/pass/drop_type_without_drop_glue.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tools/miri/tests/pass/drop_type_without_drop_glue.rs b/src/tools/miri/tests/pass/drop_type_without_drop_glue.rs new file mode 100644 index 00000000000..43ddc8a4d8b --- /dev/null +++ b/src/tools/miri/tests/pass/drop_type_without_drop_glue.rs @@ -0,0 +1,21 @@ +#![feature(custom_mir, core_intrinsics, strict_provenance)] +use std::intrinsics::mir::*; + +// The `Drop` terminator on a type with no drop glue should be a NOP. + +#[custom_mir(dialect = "runtime", phase = "optimized")] +fn drop_in_place_with_terminator(ptr: *mut i32) { + mir! { + { + Drop(*ptr, ReturnTo(after_call), UnwindContinue()) + } + after_call = { + Return() + } + } +} + +pub fn main() { + drop_in_place_with_terminator(std::ptr::without_provenance_mut(0)); + drop_in_place_with_terminator(std::ptr::without_provenance_mut(1)); +} |
