2019-04-17 15:20:33 +02:00
|
|
|
// Creating a shared reference does not leak the data to raw pointers.
|
2022-06-20 23:40:39 -07: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
|
2022-07-13 18:59:33 -04:00
|
|
|
let _val = *raw; //~ ERROR: /read access .* tag does not exist in the borrow stack/
|
2022-06-20 23:40:39 -07:00
|
|
|
}
|
|
|
|
}
|