Skip to content

Commit

Permalink
Document the super keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
poliorcetics committed Jun 25, 2020
1 parent 67100f6 commit 5232e20
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 @@ -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")]
Expand Down

0 comments on commit 5232e20

Please sign in to comment.