We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← All tracks
0 / 4
Ownership III: Lifetimes, Explicitly
RustWall 2. Elision first, then the annotations — the first `'a` you write comes after you have met E0106 and read it as a question rather than a rejection.
This track is written for Rust, which isn't the mode you're browsing in.
0
/ 8 solved
· 14 articles
- 1. Every reference already has a lifetime (you just haven't seen one) Read
- 2. A lifetime is a constraint, not a duration Read
- 3. Not solved yet. Borrow it or own it: your first lifetime decision
- 4. How to read a lifetime error Read
- 5. The three elision rules, precisely Read
- 6. Not solved yet. Let elision do it
- 7. When elision fails: reading E0106 Read
- 8. Not solved yet. `longest`: writing your first `'a`
- 9. Not solved yet. Two inputs, one output lifetime
- 10. Returning a reference to a local — the E0515 wall Read
- 11. Structs that hold references Read
- 12. Not solved yet. Zero-copy tokenizer: `Parser<'a>`
- 13. Elision rule 3 and the `&self` trap Read
- 14. Hidden, elided, named: the `'_` rule and `mismatched_lifetime_syntaxes` Read
- 15. Not solved yet. Make the lint happy: `'_` in return paths
- 16. `'static` has two completely different meanings Read
- 17. Not solved yet. `T: 'static` in practice — a type-erased handler registry
- 18. Trait objects have lifetimes too Read
- 19. Closures don't follow function elision Read
- 20. Temporary scopes: E0716 and what edition 2024 changed Read
- 21. Outlives bounds: `'a: 'b`, `T: 'a`, and implied bounds Read
- 22. Not solved yet. Generics, traits and lifetimes in one signature
Check yourself
4 questions · one attempt eachThese do not count toward finishing the track. They are here to catch the things that are easy to read past.
What does T: 'static require of T?
let lit: &'static str = "lives for the program";
fn takes_static<T: 'static>(_t: T) {}
takes_static(String::from("owned")); // compiles
Question 1 of 4