about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/reentrant-println.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/miri/tests/pass/reentrant-println.rs')
-rw-r--r--src/tools/miri/tests/pass/reentrant-println.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/miri/tests/pass/reentrant-println.rs b/src/tools/miri/tests/pass/reentrant-println.rs
new file mode 100644
index 00000000000..e73e82b8ec9
--- /dev/null
+++ b/src/tools/miri/tests/pass/reentrant-println.rs
@@ -0,0 +1,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);
+}