|
|
Log in / Subscribe / Register

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Posted Mar 23, 2022 20:12 UTC (Wed) by JoeBuck (subscriber, #2330)
Parent article: Beingessner: Rust's Unsafe Pointer Types Need An Overhaul

Instead of treating a tagged pointer as conversion to and from an integer, it seems it would be better to treat it as a pair with a pointer and a tag and treat the way these two are encoded into one field as a storage optimization the analysis doesn't have to care about. Then we no longer have to consider that any integer can alias any pointer. We just have pointers and tagged pointers. If a pointer must be aligned to a multiple of 2 and you have one tag bit, it can be free.

This would be similar to the optimization that uses just a pointer for Option<ptr>.


The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds