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