about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-03-31 01:14:49 +0200
committerGitHub <noreply@github.com>2021-03-31 01:14:49 +0200
commit2aa1bf8984f9822a1583317d4471f642fa815afd (patch)
tree97bf69da547c03429402add04508cce018dcb59c
parentd51fc973e495a4661a434cd89edd748c8a0fe0dc (diff)
parent29fe5930a3452ec6b46bf969153825e99c56b6e1 (diff)
downloadrust-2aa1bf8984f9822a1583317d4471f642fa815afd.tar.gz
rust-2aa1bf8984f9822a1583317d4471f642fa815afd.zip
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.
-rw-r--r--library/std/src/keyword_docs.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index 890fa132bea..2a3d44fb17d 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -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
 /// }
 /// ```
 ///