Skip to main content
InterviewHubPRO
Section Overview
Q26

Question 26 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

52%
Rust Systems & Tokio (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

What are Raw Pointers (`*const T` and `*mut T`) vs References (`&T` and `&mut T`)?

senior LevelrustAdvanced Internals

In Simple Words:

  • References (&T, &mut T): Always guaranteed by the compiler to be non-null, aligned, and pointing to valid data with bounded lifetimes.
  • Raw Pointers (*const T, *mut T): Similar to C pointers:
    • Allowed to be null or dangling.
    • Ignore borrowing rules (can have multiple mutable raw pointers to the same address).
    • Can only be dereferenced inside an unsafe block.