1
Fork 0

Add documentation about for used as higher ranked trait bounds

Resolves #55416
This commit is contained in:
Chris Gregory 2019-03-27 01:22:23 -04:00
parent 07d350897c
commit a68a0e33d1

View file

@ -286,11 +286,13 @@ mod fn_keyword { }
// //
/// The `for` keyword. /// The `for` keyword.
/// ///
/// `for` is primarily used in for-in-loops, but it has a few other pieces of syntactic uses such as /// `for` is primarily used in for-in-loops, but it has a few other pieces of syntactic
/// `impl Trait for Type` (see [`impl`] for more info on that). for-in-loops, or to be more /// uses. `for` is used when implementing traits as in `impl Trait for Type` (see
/// precise, iterator loops, are a simple syntactic sugar over an exceedingly common practice /// [`impl`] for more info on that). `for` is also used for [higher-ranked trait bounds]
/// within Rust, which is to loop over an iterator until that iterator returns `None` (or `break` /// as in `for<'a> &'a T: PartialEq<i32>`. for-in-loops, or to be more precise, iterator
/// is called). /// 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).
/// ///
/// ```rust /// ```rust
/// for i in 0..5 { /// for i in 0..5 {