Closed
Description
@matthewjasper realized that the current rules for retag-to-raw are not working well when the redundant reborrows around raw ptr casts are gone:
let mut x = 12;
let x = &mut x;
&*x; // Stack is frozen
let raw = &raw mut *x; // No longer creates a temporary `&mut i32`
unsafe { *raw = 42; } // Error because no Raw item got pushed
However, this will likely mean that &raw const x
and &raw mut x
are not the same operation, because the following code must not be UB:
let mut x = 12;
let x = &mut x;
let shr = &*x; // Stack is frozen
let raw = &raw const *x; // If this unfreezes...
let _val = *shr; // ... then this is UB
Also see this discussion on Zulip.