Where Are Rustlings Exercise Solutions Stored?
TLDR: Rustlings intentionally omits solutions for most exercises, storing reference implementations solely for quiz exercises in the solutions/quizzes/ directory at the repository root.
The rust-lang/rustlings repository is designed as an interactive Rust learning tool where you compile and fix broken code to progress through concepts. Unlike many tutorial projects that include comprehensive answer keys, Rustlings follows a deliberate pedagogy where you write the solutions yourself. Understanding where Rustlings exercise solutions are stored—and why most are missing—helps you navigate the project structure effectively and align with the intended learning workflow.
Official Solution Locations in the Repository
While the majority of Rustlings exercises require you to write code from scratch, the project does include a small set of reference implementations for assessment checkpoints.
Quiz Solutions in solutions/quizzes/
The only official solutions provided are for the quiz exercises, which serve as progress checkpoints throughout the curriculum. These are located in the solutions/quizzes/ directory at the root of the repository:
solutions/quizzes/quiz1.rs– Reference implementation for the first quizsolutions/quizzes/quiz2.rs– Reference implementation for the second quizsolutions/quizzes/quiz3.rs– Reference implementation for the third quiz
Each file contains fully implemented Rust code that demonstrates one possible correct solution to the quiz challenge.
Documentation in solutions/README.md
The solutions/README.md file explains the philosophy behind the missing solutions and provides guidance on how to use the quiz solutions as learning references rather than shortcuts. This documentation clarifies why the repository deliberately omits solutions for the core learning exercises.
The Exercises Directory: Where You Write the Code
The exercises/ directory at the repository root contains all the starter files you edit during your learning journey. According to the source code structure in rust-lang/rustlings, these files contain only skeleton code or intentionally failing implementations. No hidden solution files exist alongside the exercises—you are expected to modify these .rs files directly until they compile and pass the tests.
How to Access the Available Solutions
You can view the quiz solutions using several methods depending on your workflow.
Display solutions in the terminal
# View the solution for quiz 2
cat solutions/quizzes/quiz2.rs
Open solutions in a web browser
Navigate directly to the files in the GitHub repository:
- Quiz 1: https://github.com/rust-lang/rustlings/blob/main/solutions/quizzes/quiz1.rs
- Quiz 2: https://github.com/rust-lang/rustlings/blob/main/solutions/quizzes/quiz2.rs
- Quiz 3: https://github.com/rust-lang/rustlings/blob/main/solutions/quizzes/quiz3.rs
Read solutions programmatically
use std::fs;
fn main() -> std::io::Result<()> {
// Load the solution for quiz 1
let solution = fs::read_to_string("solutions/quizzes/quiz1.rs")?;
println!("Quiz 1 solution:\n{}", solution);
Ok(())
}
Summary
- Quiz solutions only: Rustlings provides reference implementations exclusively for quiz exercises in
solutions/quizzes/. - No core exercise solutions: The
exercises/directory contains only starter code without answer keys. - Pedagogical intent: The absence of solutions for most exercises forces active learning through implementation rather than copying.
- Three quiz files:
quiz1.rs,quiz2.rs, andquiz3.rsserve as the only official solution references in the repository. - Documentation:
solutions/README.mdexplains the project philosophy regarding the intentional lack of solutions.
Frequently Asked Questions
Does Rustlings provide solutions for all exercises?
No. The repository intentionally omits solutions for the core exercises to ensure you practice writing Rust code yourself. Only the three quiz exercises include official reference implementations in the solutions/quizzes/ directory, as implemented in rust-lang/rustlings.
Can I find hidden solution files in the exercises directory?
No. The exercises/ directory contains only the starter files you are meant to edit. According to the repository structure, there are no hidden solution files or answer keys stored alongside the exercise skeletons.
How should I use the quiz solutions?
Treat the quiz solutions in solutions/quizzes/ as reference material to review after attempting the quizzes yourself. The solutions/README.md file specifically advises against looking at these files before making your own attempt, as this undermines the learning process.
What if I get stuck on an exercise without a solution?
Since no official solutions exist for most exercises, you should use the Rust compiler's error messages, consult the Rust Book, or leverage community resources like the Rust Discord or Stack Overflow. The Rustlings CLI tool provides hints via the hint command to guide you without revealing complete answers.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →