Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

lifetime elision

The rules that let you leave lifetime names out of most signatures.

Lifetime elision fills in lifetimes from three rules: each elided input gets its own lifetime; a single input lifetime is given to all outputs; with &self or &mut self, self's lifetime is given to the outputs.

Examples

  • fn first_word(s: &str) -> &str needs no 'a: its one input lifetime goes to the output. fn pick(a: &str, b: &str) -> &str has two and fails with E0106.

Read the full section →