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

8 lines
176 B
Rust
Raw Normal View History

2019-11-14 10:23:29 +01:00
// error-pattern: dangling pointer was dereferenced
use std::ptr::NonNull;
fn main() { unsafe {
let ptr = NonNull::<i32>::dangling();
Box::from_raw(ptr.as_ptr());
} }