BorrowCheck

Independent Rust tests built from open sources. Learn and practise the language with questions, code snippets, explanations and a readiness rating.

Rust language core

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.

  1. Syntax, variables, types — Language basics: bindings, mutability, shadowing, scalar and compound types, integer overflow.
  2. Ownership, move, Copy/Clone — Ownership as the exclusive responsibility to drop a value; move semantics; how Copy differs from Clone.
  3. Borrowing, references, NLL — Immutable vs mutable reference rules, non-lexical lifetimes, reborrowing, splitting borrows.
  4. Lifetimes, subtyping, variance — Annotations and elision, 'static, subtyping via substitutability, the three kinds of variance, HRTB.
  5. Structs, enums, pattern matching — Structs, data-carrying enums, match exhaustiveness, refutability and pattern syntax.
  6. Strings and text — String vs &str, UTF-8 and indexing, chars/bytes/graphemes, formatting, OS and C strings.
  7. Traits, generics, dyn / impl — Defining traits, monomorphization, dyn Trait vs impl Trait, object safety, coherence.
  8. Associated types, GATs, const generics — Associated types vs type parameters, generic associated types, const generics.
  9. Collections and iterators — Choosing a collection, the Iterator trait and laziness, adapters and consumers, collect, into_iter forms, capacity.
  10. Closures — Capture modes, Fn / FnMut / FnOnce, the move keyword, closures as parameters, function pointers.
  11. Type conversions — From / Into, TryFrom, as casts, deref coercion, AsRef / Borrow, transmute.
  12. Error handling — Option and Result, the ? operator, panic and unwinding, custom error types, Box<dyn Error>.
  13. Modules, Cargo, features, editions — Module tree, visibility, crates and workspaces, features and cfg, editions and MSRV, SemVer.
  14. Smart pointers, interior mutability — Box, Rc / Arc, RefCell / Cell, Weak and cycles, Cow, the Deref trait.
  15. Drop, RAII, drop order — The Drop trait, drop order, drop flags, mem::forget and leaks, ManuallyDrop, dropck.
  16. Concurrency — Threads, Send / Sync, channels, Mutex / RwLock, atomics and memory ordering, data races.
  17. Async — Future and poll, Waker, Pin / Unpin, async fn desugaring, cancellation safety, the runtime.
  18. Unsafe, UB, FFI — Raw pointers, the unsafe contract, the UB catalog, repr and ABI, extern "C", checking with Miri.
  19. Macros — macro_rules!, hygiene, repetitions, procedural macros, derive and attributes.
  20. Testing, benchmarks, profiling — Unit, integration and doc tests, should_panic, criterion, profiling, fuzzing.
  21. Memory and type layout — Stack and heap, sizes and alignment, zero-sized types, niches, allocation cost, Sized and DSTs.
  22. Tooling — rustup, clippy and rustfmt, Miri, Playground and Godbolt, cargo commands, rustdoc.

Packs