25 lines756 B

Lesson 8: Lifetimes demystified

This lesson covers lifetimes demystified. You'll read a short explanation, try three small exercises and finish with a quiz.

Read the full lesson: https://glibcode.net/courses/rust-ownership/lessons/8

Files

  • src/main.rs: lifetime annotations when the compiler needs them

Tip: cargo clippy explains a lot of borrow-checker surprises in plain words.

Tip: Read the whole compiler message: the note at the end usually has the fix.

Tip: cargo check is much faster than cargo build while you are still fixing errors.

Run it

cargo run

Exercises

See exercises.md. Ask in the forum once you've tried.