Beyond plain references, Rust offers smart pointers that own or manage data in more sophisticated ways. `Box
For shared ownership within a single thread, `Rc
For the rare situations where the compiler's safety guarantees are too restrictive, Rust provides the `unsafe` keyword. Inside an `unsafe` block you may dereference raw pointers, call unsafe functions, access or modify mutable statics, implement unsafe traits, and access union fields. Importantly, `unsafe` does not disable the borrow checker; it merely opens a small set of additional capabilities that the programmer must verify by hand and document carefully.
Raw pointers, written `*const T` and `*mut T`, are at the heart of unsafe code. They resemble C pointers: they can be null, dangling, or aliased without complaint from the compiler. Creating a raw pointer is safe, but dereferencing one requires `unsafe`. Used sparingly, with clear invariants and thorough documentation, unsafe code lets Rust interoperate with hardware, foreign functions, and performance-critical low-level patterns while keeping the vast majority of the codebase in safe Rust.