]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-9396.rs
Rollup merge of #66134 - estebank:unknown-formatting-trait, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-9396.rs
1 // run-pass
2 #![allow(unused_must_use)]
3 #![allow(deprecated)]
4 // ignore-emscripten no threads support
5 // ignore-sgx no thread sleep support
6
7 use std::sync::mpsc::{TryRecvError, channel};
8 use std::thread;
9
10 pub fn main() {
11     let (tx, rx) = channel();
12     let t = thread::spawn(move||{
13         thread::sleep_ms(10);
14         tx.send(()).unwrap();
15     });
16     loop {
17         match rx.try_recv() {
18             Ok(()) => break,
19             Err(TryRecvError::Empty) => {}
20             Err(TryRecvError::Disconnected) => unreachable!()
21         }
22     }
23     t.join();
24 }