rust/tests/pass/reentrant-println.rs
2022-06-01 10:53:38 -04: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);
}