Skip to content

Commit fedd261

Browse files
authored
Merge pull request #540 from rust-lang/keywords
Fill in short definitons for keywords
2 parents e90abc5 + 2d448d8 commit fedd261

File tree

1 file changed

+49
-37
lines changed

1 file changed

+49
-37
lines changed
Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,70 @@
11
## Appendix A: Keywords
22

33
The following keywords are reserved by the Rust language and may not be used as
4-
names of functions, variables, macros, modules, crates, constants, static
5-
values, attributes, struct fields, or parameters.
4+
identifiers such as names of functions, variables, parameters, struct fields,
5+
modules, crates, constants, macros, static values, attributes, types, traits,
6+
or lifetimes.
7+
8+
### Keywords Currently in Use
9+
10+
* `as` - primitive casting, disambiguating the specific trait containing an
11+
item, or renaming items in `use` and `extern crate` statements
12+
* `break` - exit a loop immediately
13+
* `const` - constant items and constant raw pointers
14+
* `continue` - continue to the next loop iteration
15+
* `crate` - external crate linkage or a macro variable representing the crate
16+
in which the macro is defined
17+
* `else` - fallback for `if` and `if let` control flow constructs
18+
* `enum` - defining an enumeration
19+
* `extern` - external crate, function, and variable linkage
20+
* `false` - boolean false literal
21+
* `fn` - function definition and function pointer type
22+
* `for` - iterator loop, part of trait impl syntax, and higher-ranked lifetime
23+
syntax
24+
* `if` - conditional branching
25+
* `impl` - inherent and trait implementation block
26+
* `in` - part of `for` loop syntax
27+
* `let` - variable binding
28+
* `loop` - unconditional, infinite loop
29+
* `match` - pattern matching
30+
* `mod` - module declaration
31+
* `move` - makes a closure take ownership of all its captures
32+
* `mut` - denotes mutability in references, raw pointers, and pattern bindings
33+
* `pub` - denotes public visibility in struct fields, `impl` blocks, and modules
34+
* `ref` - by-reference binding
35+
* `return` - return from function
36+
* `Self` - type alias for the type implementing a trait
37+
* `self` - method subject or current module
38+
* `static` - global variable or lifetime lasting the entire program execution
39+
* `struct` - structure definition
40+
* `super` - parent module of the current module
41+
* `trait` - trait definition
42+
* `true` - boolean true literal
43+
* `type` - type alias and associated type definition
44+
* `unsafe` - denotes unsafe code, functions, traits, and implementations
45+
* `use` - import symbols into scope
46+
* `where` - type constraint clauses
47+
* `while` - conditional loop
48+
49+
### Keywords Reserved for Future Use
50+
51+
These keywords do not have any functionality, but are reserved by Rust for
52+
potential future use.
653

754
* `abstract`
855
* `alignof`
9-
* `as`
1056
* `become`
1157
* `box`
12-
* `break`
13-
* `const`
14-
* `continue`
15-
* `crate`
1658
* `do`
17-
* `else`
18-
* `enum`
19-
* `extern`
20-
* `false`
2159
* `final`
22-
* `fn`
23-
* `for`
24-
* `if`
25-
* `impl`
26-
* `in`
27-
* `let`
28-
* `loop`
2960
* `macro`
30-
* `match`
31-
* `mod`
32-
* `move`
33-
* `mut`
3461
* `offsetof`
3562
* `override`
3663
* `priv`
3764
* `proc`
38-
* `pub`
3965
* `pure`
40-
* `ref`
41-
* `return`
42-
* `Self`
43-
* `self`
4466
* `sizeof`
45-
* `static`
46-
* `struct`
47-
* `super`
48-
* `trait`
49-
* `true`
50-
* `type`
5167
* `typeof`
52-
* `unsafe`
5368
* `unsized`
54-
* `use`
5569
* `virtual`
56-
* `where`
57-
* `while`
5870
* `yield`

0 commit comments

Comments
 (0)