]> git.lizzy.rs Git - rust.git/commitdiff
document that crate refers to the project root
authorNathan Goldbaum <nathan12343@gmail.com>
Thu, 11 Jul 2019 18:25:53 +0000 (14:25 -0400)
committerNathan Goldbaum <nathan12343@gmail.com>
Thu, 11 Jul 2019 18:25:53 +0000 (14:25 -0400)
src/libstd/keyword_docs.rs

index d18fcb4a1da0af6899f64dac118e551deac1925b..f5018485ef7bcc05ef02ce8df1bf94f8951be295 100644 (file)
@@ -119,7 +119,7 @@ mod continue_keyword { }
 /// The `as` keyword can be used to change what the crate is referred to as in your project. If a
 /// crate name includes a dash, it is implicitly imported with the dashes replaced by underscores.
 ///
-/// `crate` is also used as in conjunction with `pub` to signify that the item it's attached to
+/// `crate` can also be used as in conjunction with `pub` to signify that the item it's attached to
 /// is public only to other members of the same crate it's in.
 ///
 /// ```rust
@@ -131,6 +131,10 @@ mod continue_keyword { }
 /// }
 /// ```
 ///
+/// `crate` is also used to represent the absolute path of a module, where `crate` refers to the
+/// root of the current crate. For instance, `crate::foo::bar` refers to the name `bar` inside the
+/// module `foo`, from anywhere else in the same crate.
+///
 /// [Reference]: ../reference/items/extern-crates.html
 mod crate_keyword { }