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
Add functions to create a dangling aligned non-null raw pointer. The
use case is to fix all the places we use "1 as *mut T" is used, in
particular in the slice iterators.
The aligned pointer has a value like 0x1, 0x4, 0x8 etc. depending on the
alignment of the pointed-to type. It is useful when a non-null pointer
is required like in references, slices, boxes, and other places.
NOTE: This changes the observable behaviour of slice iterators.
Previously, it would always yield 0x1 pointers (as references) for ZST,
including types like `[SomeType; 0]`. They now use an aligned non-null
pointer.
Expose std::ptr::dangling/_mut as new unstable functions with intent on
later stabilization, because if this low level trick is needed in
collections, the rest of the Rust ecosystem will need them as well.
0 commit comments