Skip to content

Commit

Permalink
Rollup merge of rust-lang#73718 - poliorcetics:super-keyword, r=shepm…
Browse files Browse the repository at this point in the history
…aster

Document the super keyword

Partial fix of rust-lang#34601.

Quite short, just a small example and a link to the reference.

@rustbot modify labels: T-doc,C-enhancement
  • Loading branch information
Manishearth committed Jun 26, 2020
2 parents 8769d89 + 5232e20 commit 87c1c0a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/libstd/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 87c1c0a

Please sign in to comment.