2019-04-17 08:20:33 -05:00
|
|
|
// Creating a shared reference does not leak the data to raw pointers.
|
2022-06-21 01:40:39 -05:00
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
let x = &mut 0;
|
|
|
|
let raw = x as *mut _;
|
|
|
|
let x = &mut *x; // kill `raw`
|
|
|
|
let _y = &*x; // this should not activate `raw` again
|
|
|
|
let _val = *raw; //~ ERROR borrow stack
|
|
|
|
}
|
|
|
|
}
|