tests/ui/let_unit: fix comment and example code

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.
This commit is contained in:
Joonas Koivunen 2017-08-18 17:29:05 +03:00
parent a5147e8a08
commit 171f7b4eb7

View 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;