RUST 2021 · 15 QUESTIONS · ABOUT 12 MINUTES

Can you think like the borrow checker?

In Rust, half the skill is knowing what won't compile. Fifteen snippets on ownership, borrowing, matching and traits: pick what it prints, or the error you'd get. Each answer explained. No sign-up, nothing saved.

Start the Rust test
let s1 = String::from("hi");let s2 = s1;println!("{s1}");
error[E0382]: borrow of moved value: `s1`value moved here: let s2 = s1;
QUESTION 1 / 15 · OWNERSHIPEasy

What happens?

let s1 = String::from("hi");let s2 = s1;println!("{s1}");

What this Rust test measures, in short

This test checks whether you can predict what the Rust compiler will accept and what the program will do: who owns a value, when it moves, how many borrows are allowed, how match and Option work, and how traits and the ? operator fit together.

Snippets assume Rust 2021 edition, inside fn main unless shown. The questions are our own and not standardised against a population, so treat the result as a check on your knowledge, not a certification.

By What's Your IQ · Reviewed 4 Oct 2026
Format
15 questions: output or compile error, 4 options
Topics
Ownership, borrowing, matching and Option, traits, errors and iterators
Edition
Rust 2021, stable compiler
Language
Started by Graydon Hoare; Mozilla-backed; 1.0 in 2015
LINE BY LINE

Who owns the String right now?

Every value has exactly one owner. Moving transfers it, borrowing lends it out, and when the owner goes out of scope the value is dropped. Step through to see the compiler's view.

sOWNER
t—
r—
heap: "hi" · owned by s
s is created and owns a heap-allocated String.
WRITING IT THE RUST WAY

Compiles, but fights the language

FIGHTING IT
fn port() -> u16 {	let s = std::env::var("PORT").unwrap();	s.parse().unwrap()}
IDIOMATIC
fn port() -> Result<u16, Box<dyn Error>> {	let s = std::env::var("PORT")?;	Ok(s.parse()?)}

unwrap turns every missing value or bad input into a crash. Returning Result with ? lets the caller decide what to do, and the signature tells everyone the function can fail.

~70%of serious security bugs are memory-safety issuesMicrosoft and the Chromium team both reported roughly this share in their C and C++ code. Rust's ownership rules rule out most of that class of bug at compile time.2,3
2006 → 2015From side project to 1.0. Graydon Hoare began Rust as a personal project; Mozilla sponsored it from 2009, and 1.0 shipped in May 2015 with a stability promise.1
2019 · 2020The 70% figure. Microsoft's security response team, then Chromium, published the memory-safety share in the panel.2,3
2021Its own foundation. The Rust Foundation formed with backing from AWS, Google, Huawei, Microsoft and Mozilla.
2022Into the Linux kernel. Linux 6.1 merged initial support for writing kernel code in Rust, the first language besides C to be accepted.4
  1. The Rust Team. (2015). Announcing Rust 1.0. Rust Blog.
  2. Miller, M. (2019). Trends, challenges, and strategic shifts in the software vulnerability mitigation landscape. Microsoft, BlueHat IL.
  3. The Chromium Projects. (2020). Memory safety.
  4. Corbet, J. (2022). Rust in the 6.1 kernel. LWN.net.

Where to go next

You satisfied the borrow checker. Now test your reasoning.

Our full IQ test measures the logic and working memory that ownership rules demand: 60 questions across four domains, about 30 minutes.

Take the full IQ test