Skip to content

Commit 92af886

Browse files
authored
Rollup merge of rust-lang#115053 - waywardmonkeys:augment-type-keyword-docs, r=cuviper
docs: Add example, reference link for `type` keyword. Fixes rust-lang#114281.
2 parents 2577894 + 5324570 commit 92af886

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

library/std/src/keyword_docs.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ mod true_keyword {}
18201820

18211821
#[doc(keyword = "type")]
18221822
//
1823-
/// Define an alias for an existing type.
1823+
/// Define an [alias] for an existing type.
18241824
///
18251825
/// The syntax is `type Name = ExistingType;`.
18261826
///
@@ -1838,6 +1838,13 @@ mod true_keyword {}
18381838
/// assert_eq!(m, k);
18391839
/// ```
18401840
///
1841+
/// A type can be generic:
1842+
///
1843+
/// ```rust
1844+
/// # use std::sync::{Arc, Mutex};
1845+
/// type ArcMutex<T> = Arc<Mutex<T>>;
1846+
/// ```
1847+
///
18411848
/// In traits, `type` is used to declare an [associated type]:
18421849
///
18431850
/// ```rust
@@ -1860,6 +1867,7 @@ mod true_keyword {}
18601867
///
18611868
/// [`trait`]: keyword.trait.html
18621869
/// [associated type]: ../reference/items/associated-items.html#associated-types
1870+
/// [alias]: ../reference/items/type-aliases.html
18631871
mod type_keyword {}
18641872

18651873
#[doc(keyword = "unsafe")]

0 commit comments

Comments
 (0)