rust/tests/run-pass/reentrant-println.rs
2020-04-05 10:04:53 -05:00

18 lines
413 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);
}