R
RUSTY YELLOW PAGES

finalKeyword


Explanation

final has been reserved since the 2015 edition, part of the Rust Reference's original reserved-keyword list: the lexer recognizes it as a keyword token, but no grammar rule gives it any meaning, so there is nothing you can currently write with it. Using final as an ordinary identifier is a compile error today. The raw-identifier form r#final is legal, the same escape hatch every reserved keyword offers.

It's grouped here with override and virtual because all three read like they'd belong to the same hypothetical future feature: something analogous to final in Java or C++, a marker that prevents further overriding or specialization of a trait implementation or method. No concrete RFC exists for this today — it's speculative, held in reserve in case Rust ever grows an inheritance-like or specialization mechanism where "no further overrides allowed" would be a meaningful thing to say.

Usage examples

Escaping the reservation with a raw identifier

let final = 5;     // error: expected identifier, found reserved keyword `final`
let r#final = 5;   // ok: the raw-identifier form escapes the reservation

Explanation

Embedded support: Full

Full support. Keyword reservation is a lexer-level fact, identical in #![no_std] and hosted Rust alike — final carries no defined meaning on any target, so there's no embedded-specific behavior to describe.

Usage examples

The `final` reservation, unaffected by target

let final = 5;     // error: expected identifier, found reserved keyword `final`, on every target
let r#final = 5;   // ok: the raw-identifier form escapes the reservation, on every target