From 8f76f931c243dce31e2121a265ab0501b19504d5 Mon Sep 17 00:00:00 2001 From: Isaac Andrade Date: Mon, 2 May 2016 16:15:46 -0700 Subject: [PATCH 1/2] Add mention to RFC 940 in the Rust Reference. - It also keeps mentions to RFCs consistent with the format "RFC XXX" --- src/doc/reference.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index fcf9aefaba847..87eede0b73739 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -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 +``` + +[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 From ba6ce123bac969ee896a776699a8fad651a0a1cd Mon Sep 17 00:00:00 2001 From: Isaac Andrade Date: Tue, 3 May 2016 08:29:44 -0700 Subject: [PATCH 2/2] Improve language. --- src/doc/reference.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 87eede0b73739..862e57d01605f 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -846,15 +846,15 @@ 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, +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 +// Importing the Cargo package hello-world +extern crate hello_world; // hyphen replaced with an underscore ``` [RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md