3 ms·
You’re missing the point. It doesn't matter that this is a VM feature and not a hardware feature. The fact that it exists at all means that reading from uniniti
by db48x 2y ago
You’re missing the point. It doesn't matter that this is a VM feature and not a hardware feature. The fact that it exists at all means that reading from uninitialized memory is unsound. You can write to it all you want, but not read from it.
- ajross 2y agoOnce more, the use case in question is WRITING to uninitialized memory, not reading from it. Rust is applying the constraints of the latter (and thus requiring "unsafe") to the former, which is not an unsafe operation.
- gpm 2y agoNo. Rust is only applying any constraints to reading from it. The entire discussion is how to make an API which defines which portions of the memory can be read from because they have been written to, so we can expose an API that cannot be misused. There have never been any constraints on writing to uninitialized memory.