rust/tests/run-pass/reentrant-println.rs
2020-04-05 12:09:31 -05:00

18 lines
414 B
Rust

use std::fmt::{Display, Error, Formatter};
// This test case exercises std::sys_common::remutex::ReentrantMutex
// by calling println!() from inside fmt.
struct InterruptingCow;
impl Display for InterruptingCow {
fn fmt(&self, _f: &mut Formatter<'_>) -> Result<(), Error> {
println!("Moo");
Ok(())
}
}
fn main() {
println!("\"Knock knock\" \"Who's {} there?\"", InterruptingCow);
}