3 ms·
What syntax is different with unsafe?
by rascul 4y ago
What syntax is different with unsafe?
- woodruffw 4y agoUnsafe Rust's syntax is a superset of Safe Rust, meaning that there is syntax in Unsafe Rust that will not compile in Safe Rust[1]. [1]: https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html
- biorach 4y agoIt's the same syntax. There are no special operators in unsafe rust. All unsafe code is syntactically valid safe code. The reason it will not compile it because certain operations are not permitted, not because of syntax errors
- Ygg2 4y agoThat doc needs to be rewritten. By that logic, closure Rust is another subset, and Iterator, so are pub (crate) modifiers, etc. It just allows access to: raw pointers, unsafe fields and methods, and unsafe traits.