Skip to content

docs: Add example, reference link for type keyword. #115053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion library/std/src/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ mod true_keyword {}

#[doc(keyword = "type")]
//
/// Define an alias for an existing type.
/// Define an [alias] for an existing type.
///
/// The syntax is `type Name = ExistingType;`.
///
Expand All @@ -1838,6 +1838,13 @@ mod true_keyword {}
/// assert_eq!(m, k);
/// ```
///
/// A type can be generic:
///
/// ```rust
/// # use std::sync::{Arc, Mutex};
/// type ArcMutex<T> = Arc<Mutex<T>>;
/// ```
///
/// In traits, `type` is used to declare an [associated type]:
///
/// ```rust
Expand All @@ -1860,6 +1867,7 @@ mod true_keyword {}
///
/// [`trait`]: keyword.trait.html
/// [associated type]: ../reference/items/associated-items.html#associated-types
/// [alias]: ../reference/items/type-aliases.html
mod type_keyword {}

#[doc(keyword = "unsafe")]
Expand Down