|
1 | 1 | ## Appendix A: Keywords
|
2 | 2 |
|
3 | 3 | 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. |
6 | 53 |
|
7 | 54 | * `abstract`
|
8 | 55 | * `alignof`
|
9 |
| -* `as` |
10 | 56 | * `become`
|
11 | 57 | * `box`
|
12 |
| -* `break` |
13 |
| -* `const` |
14 |
| -* `continue` |
15 |
| -* `crate` |
16 | 58 | * `do`
|
17 |
| -* `else` |
18 |
| -* `enum` |
19 |
| -* `extern` |
20 |
| -* `false` |
21 | 59 | * `final`
|
22 |
| -* `fn` |
23 |
| -* `for` |
24 |
| -* `if` |
25 |
| -* `impl` |
26 |
| -* `in` |
27 |
| -* `let` |
28 |
| -* `loop` |
29 | 60 | * `macro`
|
30 |
| -* `match` |
31 |
| -* `mod` |
32 |
| -* `move` |
33 |
| -* `mut` |
34 | 61 | * `offsetof`
|
35 | 62 | * `override`
|
36 | 63 | * `priv`
|
37 | 64 | * `proc`
|
38 |
| -* `pub` |
39 | 65 | * `pure`
|
40 |
| -* `ref` |
41 |
| -* `return` |
42 |
| -* `Self` |
43 |
| -* `self` |
44 | 66 | * `sizeof`
|
45 |
| -* `static` |
46 |
| -* `struct` |
47 |
| -* `super` |
48 |
| -* `trait` |
49 |
| -* `true` |
50 |
| -* `type` |
51 | 67 | * `typeof`
|
52 |
| -* `unsafe` |
53 | 68 | * `unsized`
|
54 |
| -* `use` |
55 | 69 | * `virtual`
|
56 |
| -* `where` |
57 |
| -* `while` |
58 | 70 | * `yield`
|
0 commit comments