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
Remove restriction on dereferencing pointers in const
We had said that the dereference operator could not be used with raw
pointers in a constant expression. However, that restriction has been
lifted. First, in Rust 1.58, we stabilized `const_raw_ptr_deref`.
rust-lang/rust#89551
This allowed for dereferencing immutable raw pointers in a constant
expression. Then, in Rust 1.83, we stabilized `const_mut_refs` and
`const_refs_to_cell`.
rust-lang/rust#129195
That allowed for:
- Mentioning `&mut` types.
- Creating `&mut` and `*mut` values.
- Creating `&T` and `*const T` values where `T` contains interior
mutability.
- Dereferencing `&mut` and `*mut` values (both for reads and writes).
Let's remove the stated restriction on dereferencing raw pointers in a
constant expression and add examples.
0 commit comments