about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/reentrant-println.rs
blob: e73e82b8ec9ed3704b857eb743fddc5e84cfbb44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
}