← All notes

Rust keywords: reserved words and raw identifiers with r#

Answer: Appendix A lists Rust keywords reserved for current or future use; they cannot be ordinary identifiers, except as raw identifiers with an r# prefix.

Keywords in use and reserved for later

Appendix A lists keywords reserved for current or future use by the language. They cannot be used as identifiers, except as raw identifiers.

The appendix treats identifiers as the names you give to things such as functions, fields, modules, crates, and lifetimes.

The appendix lists keywords currently in use, including as, async, await, and break.

as performs primitive casting, disambiguates the specific trait containing an item, or renames items in use statements.

union is a keyword only when used in a union declaration.

Words reserved for possible future use, with no functionality yet, include abstract, become, box, do, final, gen, macro, override, priv, try, typeof, unsized, virtual, and yield.

Raw identifiers

Raw identifiers are the syntax that lets you use keywords where they would not normally be allowed. You use a raw identifier by prefixing a keyword with r#.

A function named match will not compile. Naming it r#match, and calling r#match, does compile.

The r# prefix is needed on the function name in the definition and also where main calls the function.

Raw identifiers let you pick reserved words as names, and help when integrating with a language where those words are not keywords.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Rust Project Developers, Appendix A: Keywords; The Rust Project Developers, Appendix A: Keywords (source). MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Rust Project Developers, Appendix A: Keywords; The Rust Project Developers, Appendix A: Keywords (source). MIT OR Apache-2.0 (https://raw.githubusercontent.com/rust-lang/book/main/LICENSE-MIT). Copyright the Rust Project Developers.

Cite this

Permanent ID: iil:note:zrkchqxw

iinventedlight. 2026. "Rust keywords: reserved words and raw identifiers with r#." iinventedlight Library, iil:note:zrkchqxw, version of 2026-11-27. https://iinventedlight.com/library/notes/rust-keywords/. License: CC-BY-4.0.

@misc{iil_note_zrkchqxw,
  author = {{iinventedlight}},
  title = {{Rust keywords: reserved words and raw identifiers with r\#}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-27},
  url = {https://iinventedlight.com/library/notes/rust-keywords/},
  note = {Permanent ID iil:note:zrkchqxw. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/rust-keywords.md.