]>
Commit | Line | Data |
---|---|---|
ba9703b0 XL |
1 | // run-pass |
2 | // ignore-emscripten no subprocess support | |
3 | ||
fc512014 | 4 | #![feature(internal_output_capture)] |
ba9703b0 XL |
5 | |
6 | use std::fmt; | |
7 | use std::fmt::{Display, Formatter}; | |
fc512014 XL |
8 | use std::io::set_output_capture; |
9 | use std::sync::{Arc, Mutex}; | |
ba9703b0 XL |
10 | |
11 | pub struct A; | |
12 | ||
13 | impl Display for A { | |
14 | fn fmt(&self, _f: &mut Formatter<'_>) -> fmt::Result { | |
15 | panic!(); | |
16 | } | |
17 | } | |
18 | ||
19 | fn main() { | |
fc512014 | 20 | set_output_capture(Some(Arc::new(Mutex::new(Vec::new())))); |
ba9703b0 XL |
21 | assert!(std::panic::catch_unwind(|| { |
22 | eprintln!("{}", A); | |
23 | }) | |
24 | .is_err()); | |
25 | } |