diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-12 22:46:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-12 22:46:47 +0200 |
| commit | a4252fe6d289d244ada2480aab93607b4f0fc421 (patch) | |
| tree | e1a89678424d686409386b48858fb59a84bec9aa /src/libstd | |
| parent | 992bcd0266053790bc27a205aae00c26a896c800 (diff) | |
| parent | d4fcbb4bdb546cfdbfec54ecaf41b8aff5cc7858 (diff) | |
| download | rust-a4252fe6d289d244ada2480aab93607b4f0fc421.tar.gz rust-a4252fe6d289d244ada2480aab93607b4f0fc421.zip | |
Rollup merge of #62595 - ngoldbaum:path-clarity-doc, r=Centril
Document that the crate keyword refers to the project root :wave: this is my first rust contribution so I hope I'm doing everything correctly. Help very much appreciated if I'm not. As far as I can tell this use of `crate` is only documented [in the edition guide for rust 2018](https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#the-crate-keyword-refers-to-the-current-crate). However it should probably be in the documentation for the `crate` keyword itself. This adds that documentation.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/keyword_docs.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs index d18fcb4a1da..f5018485ef7 100644 --- a/src/libstd/keyword_docs.rs +++ b/src/libstd/keyword_docs.rs @@ -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 { } |
