Skip to content
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

Add documentation about for used as higher ranked trait bounds #59456

Merged
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
12 changes: 7 additions & 5 deletions src/libstd/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,13 @@ mod fn_keyword { }
//
/// The `for` keyword.
///
/// `for` is primarily used in for-in-loops, but it has a few other pieces of syntactic uses such as
/// `impl Trait for Type` (see [`impl`] for more info on that). for-in-loops, or to be more
/// precise, iterator loops, are a simple syntactic sugar over an exceedingly common practice
/// within Rust, which is to loop over an iterator until that iterator returns `None` (or `break`
/// is called).
/// `for` is primarily used in for-in-loops, but it has a few other pieces of syntactic
Centril marked this conversation as resolved.
Show resolved Hide resolved
/// uses. `for` is used when implementing traits as in `impl Trait for Type` (see
/// [`impl`] for more info on that). `for` is also used for [higher-ranked trait bounds]
/// as in `for<'a> &'a T: PartialEq<i32>`. for-in-loops, or to be more precise, iterator
/// loops, are a simple syntactic sugar over an exceedingly common practice within Rust,
Centril marked this conversation as resolved.
Show resolved Hide resolved
/// which is to loop over an iterator until that iterator returns `None` (or `break` is
/// called).
///
/// ```rust
/// for i in 0..5 {
Expand Down