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
- id: C1 claim: These keywords are reserved for current or future use by Rust and cannot be ordinary identifiers. source: S1 evidence: "keywords that are reserved for current or future use by the Rust language"
- id: C2 claim: A raw identifier is a keyword prefixed with r#. source: S2 evidence: "You use a raw identifier by prefixing a keyword with
r#."
- id: C3 claim: Some keywords, including box, try, and yield, are reserved for future use. source: S1 evidence: "The following keywords do not yet have any functionality but are reserved"
Sources
- [S1] Appendix A: Keywords. The Rust Project Developers. https://doc.rust-lang.org/book/appendix-01-keywords.html . License: MIT OR Apache-2.0. Accessed 2026-11-27.
- [S2] Appendix A: Keywords (source). The Rust Project Developers. https://raw.githubusercontent.com/rust-lang/book/main/src/appendix-01-keywords.md . License: MIT OR Apache-2.0. Accessed 2026-11-27.
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
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.},
}
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.
- rust-keywords.schema.json (schema; CC-BY-4.0)
- rust-keywords.table.json (table; CC-BY-4.0)
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.