Skip to content

Commit e95df5c

Browse files
committed
no more ref-to-ptr casts in MIR
1 parent 92042f6 commit e95df5c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

text/0000-raw-reference-mir-operator.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ With `&raw` we could instead restrict `static mut` to only allow taking raw poin
183183

184184
**Lowering of casts.** Currently, `mut_ref as *mut _` has a reborrow inserted, i.e., it gets lowered to `&mut *mut_ref as *mut _`.
185185
It seems like a good idea to lower this to `&raw mut *mut_ref` instead to avoid any effects the reborrow might have in terms of permitted aliasing.
186+
This has the side-effect of being able to entirely remove reference-to-pointer-*casts* from the MIR; that conversion would be done by a "raw reborrow" instead (which is consistent with the pointer-to-reference situation).
186187

187188
**`offsetof` woes.** As mentioned above, expressions such as `&raw mut x.field` still trigger more UB than might be expected---as witnessed by a [couple of attempts found in the wild of people implementing `offsetof`][offset-of] with something like:
188189

0 commit comments

Comments
 (0)