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

static lifetime

A reference that is valid for the whole run of the program, like a string literal.

'static is the lifetime of the entire program; &'static T refers to data that is never freed, while T: 'static means T holds no borrow shorter than that (owned data qualifies).

Loading interactive…

Examples

  • let s: &'static str = "spring"; is fine because a literal is stored in the program itself and never freed.

Read the full section →