Skip to main content
Journey Uncommon Logo
JourneyUncommon
RUST · PRACTICE

Rust interview questions.

Rust enforces memory safety at compile time. Interviews mostly test whether the borrow checker's model is in your head.

566questions
75easy
241medium
250hard

Ownership and moves, borrow lifetimes, interior mutability, Send and Sync, trait objects versus generics, and where async futures get polled.

Where it shows up: Systems programming, blockchain, browser and OS work, and teams rewriting hot paths out of C++.

Sample Rust questions

Twenty real Rust questions from the library, code snippet included. Nothing here is paraphrased for search engines. It is the same text a signed-in user sees.

hardDrop plus move interaction

A struct holds two fields, both of which implement Drop. The struct itself also implements Drop. When an instance goes out of scope, in what order do the destructors actually run?

struct Inner(&'static str);
impl Drop for Inner {
    fn drop(&mut self) { println!("drop {}", self.0); }
}
struct Outer { a: Inner, b: Inner }
impl Drop for Outer {
    fn drop(&mut self) { println!("drop Outer"); }
}
fn main() {
    let _o = Outer { a: Inner("a"), b: Inner("b") };
}
Read the full question →
Sign in to answer

Everything above is free to read. Answering needs a free account.

We keep the correct answer, the explanation and the scoring behind sign-in so the platform stays honest, which is why the answer options and the worked explanation for every Rust question stay behind a free account. Signing in is free and takes a few seconds.

Rust topics covered

53 distinct Rust topics are tagged across the library. These are the real topic labels stored on the questions, not a hand-written list.

  • async/await state machine (23)
  • Rc and Arc (22)
  • trait objects dyn vs generics (22)
  • Send and Sync auto traits (22)
  • Cow clone-on-write (20)
  • Cell vs RefCell (20)
  • Drop plus move interaction (18)
  • error handling thiserror anyhow (18)
  • Pin Unpin and self-reference (18)
  • variance co contra invariant (17)
  • Stacked/Tree Borrows (17)
  • raw pointers and UnsafeCell (15)
  • Future polling and wakers (15)
  • Box<dyn Trait> dynamic dispatch (14)
  • monomorphization and code bloat (14)
  • From and Into conversions (13)
  • Rc<RefCell<T>> combos (13)
  • closures Fn FnMut FnOnce (13)
  • Object safety rules (13)
  • lifetime annotations on structs (12)
  • Zero-cost abstraction in codegen (12)
  • RefCell and interior mutability (12)
  • associated types vs generics (12)
  • two-phase borrows (11)
  • unsafe and the aliasing model (11)
  • drop order and drop glue (11)
  • lifetimes and elision (10)
  • ownership and move (10)
  • borrow checker and NLL (10)
  • Trait coherence and orphan rule (10)
  • default and blanket impls (9)
  • collect and turbofish (9)
  • newtype and Deref (9)
  • Result and ? operator (8)
  • traits basics and impl (7)
  • enums and data variants (7)
  • niche optimization (7)
  • impl Trait (7)
  • String vs &str (6)
  • structs and tuple structs (6)
  • generic bounds and where (6)
  • borrowing & and &mut (5)
  • Option and ? on Option (5)
  • Static bound semantics (5)
  • modules and use (4)
  • derive macros (3)
  • match and exhaustiveness (3)
  • generics basics (3)
  • the borrow rules (3)
  • iterators and adapters (2)
  • HashMap and BTreeMap (2)
  • Vec and slices (1)
  • variance (1)

Search and filter every Rust question

Difficulty