diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2020-11-03 20:49:02 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2020-11-10 21:57:05 +0100 |
| commit | ccbce1d3b2b9f74619d19c6d3377d20dd06e0050 (patch) | |
| tree | 1ad1f18b68ad1c4a898314a7e849e48e39d08fdd /src/test/ui/threads-sendsync | |
| parent | 72e96604c0115ee77b0817d8bb053bcfd4625b70 (diff) | |
| download | rust-ccbce1d3b2b9f74619d19c6d3377d20dd06e0050.tar.gz rust-ccbce1d3b2b9f74619d19c6d3377d20dd06e0050.zip | |
Update tests for updated set_panic.
Diffstat (limited to 'src/test/ui/threads-sendsync')
| -rw-r--r-- | src/test/ui/threads-sendsync/task-stderr.rs | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/test/ui/threads-sendsync/task-stderr.rs b/src/test/ui/threads-sendsync/task-stderr.rs index bc4bedac196..8bd78158b54 100644 --- a/src/test/ui/threads-sendsync/task-stderr.rs +++ b/src/test/ui/threads-sendsync/task-stderr.rs @@ -1,33 +1,21 @@ // run-pass // ignore-emscripten no threads support -#![feature(box_syntax, set_stdio)] +#![feature(set_stdio)] -use std::io::prelude::*; use std::io; use std::str; use std::sync::{Arc, Mutex}; use std::thread; -struct Sink(Arc<Mutex<Vec<u8>>>); -impl Write for Sink { - fn write(&mut self, data: &[u8]) -> io::Result<usize> { - Write::write(&mut *self.0.lock().unwrap(), data) - } - fn flush(&mut self) -> io::Result<()> { Ok(()) } -} -impl io::LocalOutput for Sink { - fn clone_box(&self) -> Box<dyn io::LocalOutput> { - Box::new(Sink(self.0.clone())) - } -} - fn main() { let data = Arc::new(Mutex::new(Vec::new())); - let sink = Sink(data.clone()); - let res = thread::Builder::new().spawn(move|| -> () { - io::set_panic(Some(Box::new(sink))); - panic!("Hello, world!") + let res = thread::Builder::new().spawn({ + let data = data.clone(); + move || { + io::set_panic(Some(data)); + panic!("Hello, world!") + } }).unwrap().join(); assert!(res.is_err()); |
