about summary refs log tree commit diff
path: root/tests/ui/fmt
diff options
context:
space:
mode:
authorCaio <c410.f3r@gmail.com>2024-02-13 18:08:25 -0300
committerCaio <c410.f3r@gmail.com>2024-02-13 18:08:25 -0300
commit0e9aa75bcdf7653d1755f43547969319a559c027 (patch)
tree7a0e9537857369d92a4836ff428ef78fc46644e8 /tests/ui/fmt
parent6cc4843512d613f51ec81aba689180c31b0b28b6 (diff)
downloadrust-0e9aa75bcdf7653d1755f43547969319a559c027.tar.gz
rust-0e9aa75bcdf7653d1755f43547969319a559c027.zip
Move tests
Diffstat (limited to 'tests/ui/fmt')
-rw-r--r--tests/ui/fmt/issue-23781.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/fmt/issue-23781.rs b/tests/ui/fmt/issue-23781.rs
new file mode 100644
index 00000000000..220ebdb1872
--- /dev/null
+++ b/tests/ui/fmt/issue-23781.rs
@@ -0,0 +1,29 @@
+// run-pass
+use std::fmt;
+
+struct Foo;
+impl fmt::Debug for Foo {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        println!("<Foo as Debug>::fmt()");
+
+        write!(fmt, "")
+    }
+}
+
+fn test1() {
+    let foo_str = format!("{:?}", Foo);
+
+    println!("{}", foo_str);
+}
+
+fn test2() {
+    println!("{:?}", Foo);
+}
+
+fn main() {
+    // This works fine
+    test1();
+
+    // This fails
+    test2();
+}