2019-04-18 06:20:01 -05:00
|
|
|
use std::ptr::NonNull;
|
|
|
|
|
2022-06-21 13:27:44 -05:00
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
let x = &mut 0;
|
|
|
|
let mut ptr1 = NonNull::from(x);
|
|
|
|
let mut ptr2 = ptr1.clone();
|
|
|
|
let raw1 = ptr1.as_mut();
|
|
|
|
let _raw2 = ptr2.as_mut();
|
|
|
|
let _val = *raw1; //~ ERROR borrow stack
|
|
|
|
}
|
|
|
|
}
|