diff options
| author | Ralf Jung <post@ralfj.de> | 2024-04-18 10:23:22 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-04-18 10:23:22 +0200 |
| commit | 5c352a4e7571d09a2cc5fe9c5bc86b02d62b49d8 (patch) | |
| tree | 26b8d4c2e787ef3dc444abe7fc97b8f67bbdf743 | |
| parent | d261b5308111fa95427fcfdfd53a8331dd44a2b6 (diff) | |
add test for Drop terminator on non-drop type
| -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)); +} |
