Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Apply suggestions from code review
  • Loading branch information
poliorcetics committed Jun 28, 2020
commit e611a3fb8423f178e856813fc1a1f2397980bd8a
15 changes: 13 additions & 2 deletions src/libstd/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1479,17 +1479,28 @@ mod true_keyword {}
/// assert_eq!(m, k);
/// ```
///
/// In traits, using `type` allows the usage of an associated type without
/// knowing about it when declaring the [`trait`]:
/// In traits, `type` is used to declare an [associated type]:
///
/// ```rust
/// trait Iterator {
/// // associated type declaration
/// type Item;
/// fn next(&mut self) -> Option<Self::Item>;
/// }
///
/// struct Once<T>(Option<T>);
///
/// impl<T> Iterator for Once<T> {
/// // associated type definition
/// type Item = T;
/// fn next(&mut self) -> Option<Self::Item> {
/// self.0.take()
/// }
/// }
/// ```
///
/// [`trait`]: keyword.trait.html
/// [associated type]: ../reference/items/associated-items.html#associated-types
mod type_keyword {}

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