mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
add test for Drop terminator on non-drop type
This commit is contained in:
parent
d261b53081
commit
5c352a4e75
21
src/tools/miri/tests/pass/drop_type_without_drop_glue.rs
Normal file
21
src/tools/miri/tests/pass/drop_type_without_drop_glue.rs
Normal file
@ -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));
|
||||
}
|
Loading…
Reference in New Issue
Block a user