{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibwfia2yvnxbsxh5hezc54xxfwbjxkdg2yvptodb46cj7qhdr4ite",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mlzpdjwc2ri2"
},
"path": "/t/reducing-raw-pointer-footguns-preventing-reference-aliasing-violations-at-compile-time/24301?page=2#post_31",
"publishedAt": "2026-05-17T05:01:06.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "Having more of the matrix of invariants would certainly be nice. `unsafe<'_>` binders, for lifetime erasure. `MaybeDangling`. `UnsafePinned` or whatever it ends up being called.\n\nDon’t forget pointer tagging, though. Is there currently any other way to soundly read and manipulate the numeric value of bytes which may have providence (without exposing the pointer) other than raw pointers? Designing a non-raw-pointer-type for ergonomic pointer tagging might be interesting, I suppose. (Ah, maybe it could just be an enum, possibly with some `repr(ptr)` or something if needed for clarity, in some specific scenario guaranteed to be optimized into a single pointer, a bit like how the null optimization of `Option`-like enums is guaranteed.)\n\nEdit: hrmm I think you might be able to make “we have raw pointers at home” with references to ZSTs.\n\nI fear raw pointers won’t be able to be deprecated at this point, but I hope Rust serves as good research material for a successor language that might avoid needing them.",
"title": "Reducing Raw Pointer Footguns: Preventing Reference Aliasing Violations at Compile Time"
}