Skip to content

Commit 18a0fee

Browse files
authored
Rollup merge of rust-lang#73718 - poliorcetics:super-keyword, r=shepmaster
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
2 parents d8929b5 + 5232e20 commit 18a0fee

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/libstd/keyword_docs.rs

+18-2
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,26 @@ mod struct_keyword {}
14001400
//
14011401
/// The parent of the current [module].
14021402
///
1403-
/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
1403+
/// ```rust
1404+
/// # #![allow(dead_code)]
1405+
/// # fn main() {}
1406+
/// mod a {
1407+
/// pub fn foo() {}
1408+
/// }
1409+
/// mod b {
1410+
/// pub fn foo() {
1411+
/// super::a::foo(); // call a's foo function
1412+
/// }
1413+
/// }
1414+
/// ```
1415+
///
1416+
/// It is also possible to use `super` multiple times: `super::super::foo`,
1417+
/// going up the ancestor chain.
1418+
///
1419+
/// See the [Reference] for more information.
14041420
///
14051421
/// [module]: ../reference/items/modules.html
1406-
/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
1422+
/// [Reference]: ../reference/paths.html#super
14071423
mod super_keyword {}
14081424

14091425
#[doc(keyword = "trait")]

0 commit comments

Comments
 (0)