1 // A callee may not read the destination of our `&mut` without us noticing.
2 // Thise code got carefully checked to not introduce any reborrows
3 // that are not explicit in the source. Let's hope the compiler does not break this later!
8 // We avoid retagging at this type, and we only read, so shared vs mutable does not matter.
15 let xref1_sneaky: HiddenRef = unsafe { mem::transmute_copy(&xref1) };
16 // Derived from `xref1`, so using raw value is still ok, ...
17 let xref2 = &mut *xref1;
19 // ... though any use of it will invalidate our ref.
21 //~^ ERROR: /read access .* tag does not exist in the borrow stack/
24 fn callee(xref1: HiddenRef) {
25 // Doing the deref and the transmute (through the union) in the same place expression
26 // should avoid retagging.
27 let _val = unsafe { *xref1.r };