rust/tests/fail/stacked_borrows/issue-miri-1050-2.rs

10 lines
186 B
Rust
Raw Normal View History

//@error-pattern: is a dangling pointer
2019-11-14 03:23:29 -06:00
use std::ptr::NonNull;
fn main() {
unsafe {
let ptr = NonNull::<i32>::dangling();
2022-07-16 22:40:36 -05:00
drop(Box::from_raw(ptr.as_ptr()));
}
}