Skip to content

Commit 5232e20

Browse files
committed
Document the super keyword
1 parent 67100f6 commit 5232e20

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
@@ -1147,10 +1147,26 @@ mod struct_keyword {}
11471147
//
11481148
/// The parent of the current [module].
11491149
///
1150-
/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
1150+
/// ```rust
1151+
/// # #![allow(dead_code)]
1152+
/// # fn main() {}
1153+
/// mod a {
1154+
/// pub fn foo() {}
1155+
/// }
1156+
/// mod b {
1157+
/// pub fn foo() {
1158+
/// super::a::foo(); // call a's foo function
1159+
/// }
1160+
/// }
1161+
/// ```
1162+
///
1163+
/// It is also possible to use `super` multiple times: `super::super::foo`,
1164+
/// going up the ancestor chain.
1165+
///
1166+
/// See the [Reference] for more information.
11511167
///
11521168
/// [module]: ../reference/items/modules.html
1153-
/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
1169+
/// [Reference]: ../reference/paths.html#super
11541170
mod super_keyword {}
11551171

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

0 commit comments

Comments
 (0)