3 ms·
The way to do this in Rust is to use “unsafe.” It essentially means “trust the programmer that this pointer is live.” I don’t think there is a way around this.
by CyberRabbi 4y ago
The way to do this in Rust is to use “unsafe.” It essentially means “trust the programmer that this pointer is live.”
I don’t think there is a way around this. You’re dealing with a high-level runtime condition. There are no tractable ways to get compilers to understand these higher level runtime conditions, so conditions must be reproven at runtime. It needs an oracle. That oracle should be you but you’ve decided that you cannot be trusted. This appears to be somewhat of a contradiction. Should you even be writing this program in the first place?