diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2020-06-26 13:57:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-26 13:57:41 -0700 |
| commit | bc10bb02f5a763ffeea906c48f90114e4bfab625 (patch) | |
| tree | cf09f7357e1936d6d2793c3f744fea8d36601495 /src/libstd | |
| parent | 8d9c00d7f1b00113d1052d1e44948ec6e8597a76 (diff) | |
| parent | 5232e2025f809aa64ce3f2ba8c31004b90800485 (diff) | |
| download | rust-bc10bb02f5a763ffeea906c48f90114e4bfab625.tar.gz rust-bc10bb02f5a763ffeea906c48f90114e4bfab625.zip | |
Rollup merge of #73718 - poliorcetics:super-keyword, r=shepmaster
Document the super keyword Partial fix of #34601. Quite short, just a small example and a link to the reference. @rustbot modify labels: T-doc,C-enhancement
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 a4c48b696dd..d972cf6db18 100644 --- a/src/libstd/keyword_docs.rs +++ b/src/libstd/keyword_docs.rs @@ -1400,10 +1400,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")] |
