4 ms·
Could Rust's typesystem catch unaligned pointer dereferences?
by amelius 9y ago
Could Rust's typesystem catch unaligned pointer dereferences?
- wofo 9y agoConsidering dereferencing a pointer after doing some arithmetic on it can only be done within unsafe blocks, I would say you are at least warned about it. But it will happily compile.
- bbatha 9y agoSort of, Rust is supposed to make references to packed structure members unsafe, but currently doesn't. An RFC was accepted to change the behavior but it has not been fully implemented. Here's the tracking issue: https://github.com/rust-lang/rust/issues/27060 https://github.com/rust-lang/rust/issues/27060