]> git.lizzy.rs Git - rust.git/commitdiff
tests/ui/let_unit: fix comment and example code
authorJoonas Koivunen <joonas.koivunen@gmail.com>
Fri, 18 Aug 2017 14:29:05 +0000 (17:29 +0300)
committerJoonas Koivunen <joonas.koivunen@gmail.com>
Fri, 18 Aug 2017 14:29:05 +0000 (17:29 +0300)
The previous version would had deadlocked as the Sender remained alive
and iterator would had never became complete. Just in case someone
decided to run it.

tests/ui/let_unit.rs

index 0b0afccef45c796e98727ac98a8795b83b6ecfab..d07cf8ede2f403b2cd82a83c9c8a7d01d9896660 100644 (file)
@@ -33,9 +33,11 @@ fn consume_units_with_for_loop() {
     }
     assert_eq!(count, 3);
 
-    // Same for consuming from some other Iterator<()>.
+    // Same for consuming from some other Iterator<Item = ()>.
     let (tx, rx) = ::std::sync::mpsc::channel();
     tx.send(()).unwrap();
+    drop(tx);
+
     count = 0;
     for _ in rx.iter() {
         count += 1;