Merge set_panic and set_print into set_output_capture.
There were no use cases for setting them separately. Merging them simplifies some things.
This commit is contained in:
parent
08b7cb79e0
commit
aff7bd66e8
13 changed files with 57 additions and 131 deletions
|
|
@ -1,11 +1,11 @@
|
|||
// run-pass
|
||||
// ignore-emscripten no subprocess support
|
||||
|
||||
#![feature(set_stdio)]
|
||||
#![feature(internal_output_capture)]
|
||||
|
||||
use std::fmt;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::io::set_panic;
|
||||
use std::io::set_output_capture;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub struct A;
|
||||
|
|
@ -17,7 +17,7 @@ impl Display for A {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
set_panic(Some(Arc::new(Mutex::new(Vec::new()))));
|
||||
set_output_capture(Some(Arc::new(Mutex::new(Vec::new()))));
|
||||
assert!(std::panic::catch_unwind(|| {
|
||||
eprintln!("{}", A);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// run-pass
|
||||
// ignore-emscripten no threads support
|
||||
|
||||
#![feature(set_stdio)]
|
||||
#![feature(internal_output_capture)]
|
||||
|
||||
use std::io;
|
||||
use std::str;
|
||||
|
|
@ -13,7 +13,7 @@ fn main() {
|
|||
let res = thread::Builder::new().spawn({
|
||||
let data = data.clone();
|
||||
move || {
|
||||
io::set_panic(Some(data));
|
||||
io::set_output_capture(Some(data));
|
||||
panic!("Hello, world!")
|
||||
}
|
||||
}).unwrap().join();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue