Skip to content

Commit c8e4ff0

Browse files
authored
Rollup merge of rust-lang#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.
2 parents 2815173 + fbebff3 commit c8e4ff0

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

std/src/keyword_docs.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,18 @@ mod fn_keyword {}
547547
/// # fn code() { }
548548
/// # let iterator = 0..2;
549549
/// {
550-
/// let mut _iter = std::iter::IntoIterator::into_iter(iterator);
551-
/// loop {
552-
/// match _iter.next() {
553-
/// Some(loop_variable) => {
554-
/// code()
555-
/// },
556-
/// None => break,
557-
/// }
558-
/// }
550+
/// let result = match IntoIterator::into_iter(iterator) {
551+
/// mut iter => loop {
552+
/// let next;
553+
/// match iter.next() {
554+
/// Some(val) => next = val,
555+
/// None => break,
556+
/// };
557+
/// let loop_variable = next;
558+
/// let () = { code(); };
559+
/// },
560+
/// };
561+
/// result
559562
/// }
560563
/// ```
561564
///

0 commit comments

Comments
 (0)