about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-05-27 20:20:17 +0200
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-06-01 18:33:47 +0200
commitcfdbff7c125cbdd5a2b75e526717413718d16111 (patch)
tree451f7b5b3a0f7b4a34eba2fc4310b78f0414f8d8 /src/libcore
parenta11c26f6acb1b8890c36196e88371840c01e201d (diff)
downloadrust-cfdbff7c125cbdd5a2b75e526717413718d16111.tar.gz
rust-cfdbff7c125cbdd5a2b75e526717413718d16111.zip
Change for-loop desugar to not borrow the iterator during the loop
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter/mod.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs
index 5eefa59e7ea..37cc6f98e73 100644
--- a/src/libcore/iter/mod.rs
+++ b/src/libcore/iter/mod.rs
@@ -191,10 +191,11 @@
 //! {
 //!     let result = match IntoIterator::into_iter(values) {
 //!         mut iter => loop {
-//!             match iter.next() {
-//!                 Some(x) => { println!("{}", x); },
+//!             let x = match iter.next() {
+//!                 Some(val) => val,
 //!                 None => break,
-//!             }
+//!             };
+//!             let () = { println!("{}", x); };
 //!         },
 //!     };
 //!     result