Skip to content

Commit 9766a93

Browse files
committed
Document the mod keyword
1 parent 1a4e2b6 commit 9766a93

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/libstd/keyword_docs.rs

+20-2
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,28 @@ mod match_keyword {}
913913
//
914914
/// Organize code into [modules].
915915
///
916-
/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
916+
/// Use `mod` to create new [modules] to encapsulate code, including other
917+
/// modules:
917918
///
919+
/// ```
920+
/// mod foo {
921+
/// mod bar {
922+
/// type MyType = (u8, u8);
923+
/// fn baz() {}
924+
/// }
925+
/// }
926+
/// ```
927+
///
928+
/// Like [`struct`]s and [`enum`]s, a module and its content are private by
929+
/// default, unaccessible to code outside of the module.
930+
///
931+
/// To learn more about allowing access, see the documentation for the [`pub`]
932+
/// keyword.
933+
///
934+
/// [`enum`]: keyword.enum.html
935+
/// [`pub`]: keyword.pub.html
936+
/// [`struct`]: keyword.struct.html
918937
/// [modules]: ../reference/items/modules.html
919-
/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
920938
mod mod_keyword {}
921939

922940
#[doc(keyword = "move")]

0 commit comments

Comments
 (0)