You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@matthewjasper realized that the current rules for retag-to-raw are not working well when the redundant reborrows around raw ptr casts are gone:
letmut x = 12;let x = &mut x;&*x;// Stack is frozenlet 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:
letmut x = 12;let x = &mut x;let shr = &*x;// Stack is frozenlet raw = &raw const *x;// If this unfreezes...let _val = *shr;// ... then this is UB
I also just realized that currently, x as *mut T where x: &mut Teffectively counts as a write access, because of the implicit reborrow. Things would likely break if that were to change. And it actually makes some sense, we want to push a new tag after all and we should only do that after popping old stuff away.
I think this is basically solved on the Stacked Borrows side, but we need to figure out what we really want (x: &mut T) as *const T to mean. That is tracked at rust-lang/rust#56604.
@matthewjasper realized that the current rules for retag-to-raw are not working well when the redundant reborrows around raw ptr casts are gone:
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:Also see this discussion on Zulip.
The text was updated successfully, but these errors were encountered: