Master Rust, One Quest at a Time

Interactive coding challenges that teach Rust through hands-on practice — from ownership puzzles to borrow-checker quests.

Start Your Quest

Quest Map

Follow the path from beginner to advanced. Each quest builds on the last.

1

Ownership

Beginner
✓ Complete +120 XP

Borrowing

Beginner
✓ Complete +150 XP
2
3

Lifetimes

Intermediate
In Progress +200 XP

Traits

Intermediate
Locked +250 XP
4
5

Generics

Intermediate
Locked +250 XP

Error Handling

Advanced
Locked +300 XP
6
7

Async/Await

Advanced
Locked +350 XP

Code Challenge Preview

Tackle real Rust problems with instant feedback from the compiler.

main.rs lib.rs
fn longest<'a>(
    x: &'a str,
    y: &'a str,
) -> &'a str {
    if x.len() > y.len() {
        x
    } else {
        y
    }
}

fn main() {
    let string1 = String::from("long string");
    let result;
    {
        let string2 = String::from("xyz");
        result = longest(
            string1.as_str(),
            string2.as_str(),
        );
    }
    // Does this compile? Why or why not?
    println!("{}", result);
}
Quest 3 · Challenge 4

Lifetime Annotations

The function longest returns a reference, but the compiler needs to know how long that reference is valid. Analyze this code and determine whether it will compile.

error[E0597]: string2 does not live long enough
help: The borrowed value string2 is dropped while still borrowed by result.

Achievements

Collect badges as you conquer each quest.

First Compile
Zero Warnings
Move Semantics
?
Lifetime Master
?
Trait Wizard
?
Async Hero
0 Quests Available
0 Learning Chapters
0 XP to Earn
0 Achievements