Questions

Rust questions

Choose a question page, learn the concept, then test your understanding with a quiz.

What `let fields = fields;` Does in Rust

Learn what `let x = x;` means in Rust, how shadowing works, and why developers use `let fields = fields;` in real Rust code.

rust

When Rust Closures Implement Fn, FnMut, and FnOnce

Learn when Rust closures implement Fn, FnMut, and FnOnce, how capture behavior affects each trait, and how to choose the right bound.

rustclosures

When to Use #[inline], #[inline(always)], and #[inline(never)] in Rust

Learn when to use Rust inline attributes, what they actually mean, and when #[inline], #[inline(always)], or #[inline(never)] help or hurt.

rustinlinellvm-codegen

Why Capitalizing the First Letter of a String Is Different in Rust

Learn why Rust string capitalization is tricky, why &str cannot be indexed, and the simplest safe ways to uppercase the first letter.

ruststringuppercase

Why Explicit Lifetimes Are Needed in Rust

Learn why Rust needs explicit lifetimes, when inference is enough, and when lifetime annotations are required for safe references.

rustreferencestatic-analysislifetime

Why Rust Avoids &String, &Vec, and &Box in Function Arguments

Learn why Rust functions usually take &str, slices, or plain references instead of &String, &Vec, and &Box, with examples and best practices.

rust

Why Rust Cannot Store a Value and a Reference to It in the Same Struct

Learn why self-referential structs fail in Rust, what lifetime errors mean, and practical ways to model owned data safely.

rustreferencelifetimeborrow-checker

Why Rust Executables Are So Large: Understanding Binary Size in Rust

Learn why Rust binaries can seem large, what gets included in a build, and how debug, release, stripping, and panic settings affect size.

rustrust-cargo

Why Rust May Not Optimize Non-Aliasing Mutable References Yet

Learn why Rust mutable references imply no aliasing, why LLVM may still avoid some optimizations, and how this relates to UB and codegen.

rustreferencecompiler-optimizationllvm-codegen

Why You Can't Index a String in Rust and How to Access Characters Safely

Learn why Rust strings cannot be indexed by number and how to access characters safely using chars, bytes, and iterators.

ruststringindexing

Why `println!` Doesn’t Show in Rust Unit Tests

Learn why `println!` output is hidden in Rust unit tests, how test output capture works, and how to display debug prints when needed.

rusttestingprintln

Why `println!` Uses an Exclamation Mark in Rust

Learn why `println!` ends with `!` in Rust, what macros are, and how they differ from functions with beginner-friendly examples.

rust

Page 6 of 6 - 112 questions