-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fill in short definitons for keywords #540
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
02ba07f
Fill in short definitons for keywords
carols10cents df2faed
Add more places you can't use keywords
carols10cents 6f7a720
Move all crates reserved for future use to the end
carols10cents 4de7a36
Wording tweaks in keyword explanations
carols10cents 120c1c1
Fix spelling of implementer
carols10cents 2d448d8
Tweaks to crate and Self
carols10cents File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,70 @@ | ||
## Appendix A: Keywords | ||
|
||
The following keywords are reserved by the Rust language and may not be used as | ||
names of functions, variables, macros, modules, crates, constants, static | ||
values, attributes, struct fields, or parameters. | ||
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 in `use` and `extern crate` statements | ||
* `break` - exit a loop immediately | ||
* `const` - constant items and constant raw pointers | ||
* `continue` - continue to the next loop iteration | ||
* `crate` - external crate linkage or a macro variable representing the crate | ||
in which the macro is defined | ||
* `else` - fallback for `if` and `if let` control flow constructs | ||
* `enum` - defining an enumeration | ||
* `extern` - external crate, function, and variable linkage | ||
* `false` - boolean false literal | ||
* `fn` - function definition and function pointer type | ||
* `for` - iterator loop, part of trait impl syntax, and higher-ranked lifetime | ||
syntax | ||
* `if` - conditional branching | ||
* `impl` - inherent and trait implementation block | ||
* `in` - part of `for` loop syntax | ||
* `let` - variable binding | ||
* `loop` - unconditional, infinite loop | ||
* `match` - pattern matching | ||
* `mod` - module declaration | ||
* `move` - makes a closure take ownership of all its captures | ||
* `mut` - denotes mutability in references, raw pointers, and pattern bindings | ||
* `pub` - denotes public visibility in struct fields, `impl` blocks, and modules | ||
* `ref` - by-reference binding | ||
* `return` - return from function | ||
* `Self` - type alias for the type implementing a trait | ||
* `self` - method subject or current module | ||
* `static` - global variable or lifetime lasting the entire program execution | ||
* `struct` - structure definition | ||
* `super` - parent module of the current module | ||
* `trait` - trait definition | ||
* `true` - boolean true literal | ||
* `type` - type alias and associated type definition | ||
* `unsafe` - denotes unsafe code, functions, traits, and implementations | ||
* `use` - import symbols into scope | ||
* `where` - type constraint clauses | ||
* `while` - 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` | ||
* `as` | ||
* `become` | ||
* `box` | ||
* `break` | ||
* `const` | ||
* `continue` | ||
* `crate` | ||
* `do` | ||
* `else` | ||
* `enum` | ||
* `extern` | ||
* `false` | ||
* `final` | ||
* `fn` | ||
* `for` | ||
* `if` | ||
* `impl` | ||
* `in` | ||
* `let` | ||
* `loop` | ||
* `macro` | ||
* `match` | ||
* `mod` | ||
* `move` | ||
* `mut` | ||
* `offsetof` | ||
* `override` | ||
* `priv` | ||
* `proc` | ||
* `pub` | ||
* `pure` | ||
* `ref` | ||
* `return` | ||
* `Self` | ||
* `self` | ||
* `sizeof` | ||
* `static` | ||
* `struct` | ||
* `super` | ||
* `trait` | ||
* `true` | ||
* `type` | ||
* `typeof` | ||
* `unsafe` | ||
* `unsized` | ||
* `use` | ||
* `virtual` | ||
* `where` | ||
* `while` | ||
* `yield` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's looking to be stabilised soon,
pub(in path)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to put
pub(thing)
in the newest features appendix, which isn't going to be in print, so I think we should leave it out of the printed keyword index. Actually, I might be convinced otherwise, since there are other things in this keyword index we don't really talk about in the book.... idk. I'm going to leave it out for now at least until it's stable.