Appendix A: Keywords
The following keywords are reserved by the Rust language and may not be used as identifiers such as names of functions, variables, parameters, struct fields, modules, crates, constants, macros, static values, attributes, types, traits, or lifetimes.
Keywords Currently in Use
as
- primitive casting, disambiguating the specific trait containing an item, or renaming items inuse
andextern crate
statementsbreak
- exit a loop immediatelyconst
- constant items and constant raw pointerscontinue
- continue to the next loop iterationcrate
- external crate linkage or a macro variable representing the crate in which the macro is definedelse
- fallback forif
andif let
control flow constructsenum
- defining an enumerationextern
- external crate, function, and variable linkagefalse
- Boolean false literalfn
- function definition and function pointer typefor
- iterator loop, part of trait impl syntax, and higher-ranked lifetime syntaxif
- conditional branchingimpl
- inherent and trait implementation blockin
- part offor
loop syntaxlet
- variable bindingloop
- unconditional, infinite loopmatch
- pattern matchingmod
- module declarationmove
- makes a closure take ownership of all its capturesmut
- denotes mutability in references, raw pointers, and pattern bindingspub
- denotes public visibility in struct fields,impl
blocks, and modulesref
- by-reference bindingreturn
- return from functionSelf
- type alias for the type implementing a traitself
- method subject or current modulestatic
- global variable or lifetime lasting the entire program executionstruct
- structure definitionsuper
- parent module of the current moduletrait
- trait definitiontrue
- Boolean true literaltype
- type alias and associated type definitionunsafe
- denotes unsafe code, functions, traits, and implementationsuse
- import symbols into scopewhere
- type constraint clauseswhile
- conditional loop
Keywords Reserved for Future Use
These keywords do not have any functionality, but are reserved by Rust for potential future use.
abstract
alignof
become
box
do
final
macro
offsetof
override
priv
proc
pure
sizeof
typeof
unsized
virtual
yield