mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #83680 - ibraheemdev:patch-2, r=Dylan-DPC
Update for loop desugaring docs It looks like the documentation for `for` loops was not updated to match the new de-sugaring process.
This commit is contained in:
commit
2aa1bf8984
@ -547,15 +547,18 @@ mod fn_keyword {}
|
||||
/// # fn code() { }
|
||||
/// # let iterator = 0..2;
|
||||
/// {
|
||||
/// let mut _iter = std::iter::IntoIterator::into_iter(iterator);
|
||||
/// loop {
|
||||
/// match _iter.next() {
|
||||
/// Some(loop_variable) => {
|
||||
/// code()
|
||||
/// },
|
||||
/// None => break,
|
||||
/// }
|
||||
/// }
|
||||
/// let result = match IntoIterator::into_iter(iterator) {
|
||||
/// mut iter => loop {
|
||||
/// let next;
|
||||
/// match iter.next() {
|
||||
/// Some(val) => next = val,
|
||||
/// None => break,
|
||||
/// };
|
||||
/// let loop_variable = next;
|
||||
/// let () = { code(); };
|
||||
/// },
|
||||
/// };
|
||||
/// result
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user