{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifqqmd543yznckvzcaskk432aw6o3sjehzifjlcs2mli6vijcldqu",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mghz7umfoxl2"
  },
  "path": "/t/idea-pre-rfc-null-free-pointer-and-zeroable-reference/23991?page=5#post_94",
  "publishedAt": "2026-03-07T10:32:47.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "This direction has merit - having non-volatile, optimisable primitives for accessing memory outside the AM's allocation model would cover a real gap that `read_volatile`/`write_volatile` currently fill imperfectly, and I think it could complement the proposal well.\n\nThat said, I'm not sure it alone would be sufficient for cases like the `DevTreeBlob` example in the OP, where the hardware places a structure at 0x0 on a 16-bit target with no spare RAM. There, what's needed is `&mut DevTreeBlob` to call methods, mutate fields, and pass to APIs that expect references and no composition of individual read/write primitives can produce that. There's also the concern that each `core::ptr` function would need a corresponding variant, which could add considerable API surface.\n\nH4n_uL:\n\n>\n>     // This address is forced by the hardware.\n>     // Rust does not get to choose it.\n>     const BLOB_P: usize = 0;\n>     const _: () = assert!(usize::BITS == 16);\n>\n>     #[unsafe(no_mangle)]\n>     extern \"C\" fn ignite() -> ! {\n>         // BLOB can never be read volatilely;\n>         // There's no available RAM to copy the entire struct.\n>         let mut blob = unsafe { &mut *(BLOB_P as *mut DevTreeBlob) };\n>         // instant UB upon reference construction\n>\n>         let mapping = blob.foo();\n>         blob.bar |= 0b1;\n>\n>         ...\n>     }\n>\n\nStill, thank you for the thought-out suggestion. This could be a useful building block regardless of how the reference question is resolved.",
  "title": "Idea / Pre-RFC: Null-free pointer and Zeroable reference"
}