External Publication
Visit Post

Idea / Pre-RFC: Null-free pointer and Zeroable reference

Rust Internals [Unofficial] March 7, 2026
Source

With CodesInChaos' suggestion in #93, couldn't the ergonomics be improved by a proc macro that rewrites something like this...

#[foo]
impl DevTreeBlob {
    fn blah(&mut self) -> u32 {
        self.xxx = 123;
        self.yyy
    }
}

...into something like this...

impl DevTreeBlob {
    fn blah(ptr: *mut Self) -> u32 {
        core::ptr::write_memory(&raw mut ptr.xxx, 123);
        core::ptr::read_memory(&raw ptr.yyy)
    }
}

...and that would satisfy most of your needs?

Discussion in the ATmosphere

Loading comments...