diff options
| author | Alexis Bourget <alexis.bourget@gmail.com> | 2020-06-25 11:40:07 +0200 |
|---|---|---|
| committer | Alexis Bourget <alexis.bourget@gmail.com> | 2020-06-25 11:40:07 +0200 |
| commit | 5232e2025f809aa64ce3f2ba8c31004b90800485 (patch) | |
| tree | 18bc69af0f89f91f01f19fa86e407bf1d15c10be /src/libstd | |
| parent | 67100f61e62a86f2bf9e38552ee138e231eddc74 (diff) | |
| download | rust-5232e2025f809aa64ce3f2ba8c31004b90800485.tar.gz rust-5232e2025f809aa64ce3f2ba8c31004b90800485.zip | |
Document the super keyword
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/keyword_docs.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs index a4996d9eee8..25868c9cfeb 100644 --- a/src/libstd/keyword_docs.rs +++ b/src/libstd/keyword_docs.rs @@ -1147,10 +1147,26 @@ mod struct_keyword {} // /// The parent of the current [module]. /// -/// The documentation for this keyword is [not yet complete]. Pull requests welcome! +/// ```rust +/// # #![allow(dead_code)] +/// # fn main() {} +/// mod a { +/// pub fn foo() {} +/// } +/// mod b { +/// pub fn foo() { +/// super::a::foo(); // call a's foo function +/// } +/// } +/// ``` +/// +/// It is also possible to use `super` multiple times: `super::super::foo`, +/// going up the ancestor chain. +/// +/// See the [Reference] for more information. /// /// [module]: ../reference/items/modules.html -/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601 +/// [Reference]: ../reference/paths.html#super mod super_keyword {} #[doc(keyword = "trait")] |
