summaryrefslogtreecommitdiff
path: root/src/tools/miri/tests/fail/stacked_borrows/illegal_write2.rs
blob: bf4204c61fd726747b237fbc65581a3fdd3774f6 (plain)
1
2
3
4
5
6
7
8
9
10
#![allow(drop_ref)]

fn main() {
    let target = &mut 42;
    let target2 = target as *mut _;
    drop(&mut *target); // reborrow
    // Now make sure our ref is still the only one.
    unsafe { *target2 = 13 }; //~ ERROR: /write access .* tag does not exist in the borrow stack/
    let _val = *target;
}