-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add mention to RFC 940 in the Rust Reference. #33362
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 |
---|---|---|
|
@@ -845,6 +845,20 @@ extern crate std; // equivalent to: extern crate std as std; | |
extern crate std as ruststd; // linking to 'std' under another name | ||
``` | ||
|
||
When naming Rust crates, hyphens are disallowed. However, Cargo packages may | ||
make use of them. In such case, when `cargo.toml` doesn't specify a crate name, | ||
Cargo will transparently replace `-` with `_` (Refer to [RFC 940] for more | ||
details). | ||
|
||
Here is an example: | ||
|
||
```{.ignore} | ||
// Importing the Cargo package hello-world/ | ||
extern crate hello_world; // The crate name replaced the hyphen | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
``` | ||
|
||
[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md | ||
|
||
#### Use declarations | ||
|
||
A _use declaration_ creates one or more local name bindings synonymous with | ||
|
@@ -3720,9 +3734,9 @@ Since `'static` "lives longer" than `'a`, `&'static str` is a subtype of | |
|
||
## Type coercions | ||
|
||
Coercions are defined in [RFC401]. A coercion is implicit and has no syntax. | ||
Coercions are defined in [RFC 401]. A coercion is implicit and has no syntax. | ||
|
||
[RFC401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md | ||
[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md | ||
|
||
### Coercion sites | ||
|
||
|
@@ -3862,7 +3876,7 @@ Coercion is allowed between the following types: | |
|
||
In the future, coerce_inner will be recursively extended to tuples and | ||
structs. In addition, coercions from sub-traits to super-traits will be | ||
added. See [RFC401] for more details. | ||
added. See [RFC 401] for more details. | ||
|
||
# Special traits | ||
|
||
|
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.
Cargo.toml is has a capital c