Reserved words
Reserved words
These identifiers are reserved. None of them can be used as a variable, a parameter, a field, or a function name, including in an FFI signature.
Args arch as blockexit break
class closure const constant constructor
continue danger_cast else enum export
external false fn for from
gcsafe hide if impl import
in let link module mutates
new notrack null opaque operator
platform private public return serial
state static style super switch
trait true variadic while
The ones that catch people
Three of these read like ordinary nouns and are the usual cause of a confusing parse failure:
fn, which is tempting as a shorthand parameter name for a function or a file name.in, which is natural for a parameter meaning input.arch, which is natural for a variable holding a processor architecture.
A reserved word used as an identifier does not produce one clear error. The parse fails at that point and the failure cascades, so the file reports many unrelated-looking errors elsewhere. If a small edit suddenly produces a large number of errors, look for a newly introduced reserved word before reading any of them.