]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-23781.rs
New upstream version 1.60.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-23781.rs
1 // run-pass
2 use std::fmt;
3
4 struct Foo;
5 impl fmt::Debug for Foo {
6 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
7 println!("<Foo as Debug>::fmt()");
8
9 write!(fmt, "")
10 }
11 }
12
13 fn test1() {
14 let foo_str = format!("{:?}", Foo);
15
16 println!("{}", foo_str);
17 }
18
19 fn test2() {
20 println!("{:?}", Foo);
21 }
22
23 fn main() {
24 // This works fine
25 test1();
26
27 // This fails
28 test2();
29 }