Unsafe Rust & FFI
Unsafe Rust and FFI are the parts of Rust where correctness depends on explicit human-maintained invariants around memory, aliasing, layout, ABI, initialization, and foreign code.
Concepts
Patterns
Safe Abstractions over Unsafe Code
Antipatterns
The static mut Footgun and &raw
Sources
- The Rust Programming Language, ch. 20.1 “Unsafe Rust” — the-book, https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html
- The Rust Reference, “Unsafety” — the-reference, https://doc.rust-lang.org/reference/unsafety.html
- The Rust Reference, “External blocks” — the-reference, https://doc.rust-lang.org/reference/items/external-blocks.html
- The Rust Reference, “Behavior considered undefined” — the-reference, https://doc.rust-lang.org/reference/behavior-considered-undefined.html
- The Rustonomicon — rustonomicon, https://doc.rust-lang.org/nomicon/
