Rust language core
Ownership, borrowing, lifetimes, traits, concurrency, async, unsafe.
The core covers the Rust language itself, to the extent The Book, the Rustonomicon and Rust by Example describe it, without third-party crates or application areas. The topics go from syntax and the ownership system through types, traits, collections and error handling to smart pointers, concurrency, async, unsafe and macros; testing, memory layout and tooling close the core. Each topic is split into subtopics. The questions check the basic rules, the mechanism behind them and the edge cases; every question comes with an info page that links to the primary sources.
Topics
- Syntax, variables, types — Language basics: bindings, mutability, shadowing, scalar and compound types, integer overflow.
- Ownership, move, Copy/Clone — Ownership as the exclusive responsibility to drop a value; move semantics; how
Copydiffers fromClone. - Borrowing, references, NLL — Immutable vs mutable reference rules, non-lexical lifetimes, reborrowing, splitting borrows.
- Lifetimes, subtyping, variance — Annotations and elision,
'static, subtyping via substitutability, the three kinds of variance, HRTB. - Structs, enums, pattern matching — Structs, data-carrying enums,
matchexhaustiveness, refutability and pattern syntax. - Strings and text —
Stringvs&str, UTF-8 and indexing, chars/bytes/graphemes, formatting, OS and C strings. - Traits, generics, dyn / impl — Defining traits, monomorphization,
dyn Traitvsimpl Trait, object safety, coherence. - Associated types, GATs, const generics — Associated types vs type parameters, generic associated types, const generics.
- Collections and iterators — Choosing a collection, the
Iteratortrait and laziness, adapters and consumers,collect,into_iterforms, capacity. - Closures — Capture modes,
Fn/FnMut/FnOnce, themovekeyword, closures as parameters, function pointers. - Type conversions —
From/Into,TryFrom,ascasts, deref coercion,AsRef/Borrow,transmute. - Error handling —
OptionandResult, the?operator, panic and unwinding, custom error types,Box<dyn Error>. - Modules, Cargo, features, editions — Module tree, visibility, crates and workspaces, features and
cfg, editions and MSRV, SemVer. - Smart pointers, interior mutability —
Box,Rc/Arc,RefCell/Cell,Weakand cycles,Cow, theDereftrait. - Drop, RAII, drop order — The
Droptrait, drop order, drop flags,mem::forgetand leaks,ManuallyDrop, dropck. - Concurrency — Threads,
Send/Sync, channels,Mutex/RwLock, atomics and memory ordering, data races. - Async —
Futureandpoll,Waker,Pin/Unpin,async fndesugaring, cancellation safety, the runtime. - Unsafe, UB, FFI — Raw pointers, the
unsafecontract, the UB catalog,reprand ABI,extern "C", checking with Miri. - Macros —
macro_rules!, hygiene, repetitions, procedural macros,deriveand attributes. - Testing, benchmarks, profiling — Unit, integration and doc tests,
should_panic,criterion, profiling, fuzzing. - Memory and type layout — Stack and heap, sizes and alignment, zero-sized types, niches, allocation cost,
Sizedand DSTs. - Tooling —
rustup,clippyandrustfmt, Miri, Playground and Godbolt,cargocommands,rustdoc.