keyword

Rust reserved keywords: names you cannot use directly

Rust reserves these 13 names in the selected edition: `abstract`, `become`, `box`, `do`, `final`, `macro`, `override`, `priv`, `try`, `typeof`, `unsized`, `virtual`, `yield`. They do not provide stable language constructs in Rust 2024 at the teaching baseline. `try` became reserved in 2018; `gen` (covered separately in V2) in 2024. Prefer descriptive names. Raw identifiers let you use many keyword spellings as names, not as new language features. Expected output (not executed): 4 Why: The prefix makes try a variable name; adding one gives four. Common mistake: Do not write `let try = 3;` in edition 2024. The raw prefix is not a universal escape for every keyword (for example `r#self` is invalid).

Formal Syntax & Structure

rust syntaxrust
r#identifier

Working Example

Example Snippetrust
fn main() {    let r#try = 3;    let attempt_count = r#try + 1;    println!("{attempt_count}");}
Rust Reference