References have niches, but do pointers really have niches? Unlike references; null, unaligned and dangling pointers are all possible.
2 Likes
Raw pointers do not have niches. NonNull
has a niche though, obviously. fn
pointers also have a niche (at null).
3 Likes
I'd suggest checking out the WIP strict provenance docs. Support for tagged pointers is already covered there:
The nightly-only map_addr
and wrapping_offset
methods on the pointer primitive type can be used to add/remove tagging data while still preserving pointer provenance.
The "trick" here is that the pointer types must stay pointer types the entire time, and can't be converted to e.g. usize
or else they'll lose the provenance information.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.