1
Fork 0

Rollup merge of #73619 - poliorcetics:mod-keyword, r=steveklabnik

Document the mod keyword

Partial fix for #34601 .

Documentation for the `mod` keyword.
This commit is contained in:
Manish Goregaokar 2020-06-25 18:00:16 -07:00 committed by GitHub
commit 01a293a838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -913,10 +913,28 @@ mod match_keyword {}
// //
/// Organize code into [modules]. /// Organize code into [modules].
/// ///
/// The documentation for this keyword is [not yet complete]. Pull requests welcome! /// Use `mod` to create new [modules] to encapsulate code, including other
/// modules:
/// ///
/// ```
/// mod foo {
/// mod bar {
/// type MyType = (u8, u8);
/// fn baz() {}
/// }
/// }
/// ```
///
/// Like [`struct`]s and [`enum`]s, a module and its content are private by
/// default, unaccessible to code outside of the module.
///
/// To learn more about allowing access, see the documentation for the [`pub`]
/// keyword.
///
/// [`enum`]: keyword.enum.html
/// [`pub`]: keyword.pub.html
/// [`struct`]: keyword.struct.html
/// [modules]: ../reference/items/modules.html /// [modules]: ../reference/items/modules.html
/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
mod mod_keyword {} mod mod_keyword {}
#[doc(keyword = "move")] #[doc(keyword = "move")]