about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/stacked_borrows/illegal_read6.rs
blob: 4af22580ab64fd968838811cd8dc44ef3ca8ebf9 (plain)
1
2
3
4
5
6
7
8
9
10
// Creating a shared reference does not leak the data to raw pointers.
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: /read access .* tag does not exist in the borrow stack/
    }
}