We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 085fbe9 + cd398a6 commit eea5f8aCopy full SHA for eea5f8a
tests/ui/panics/fmt-only-once.rs
@@ -0,0 +1,21 @@
1
+// run-fail
2
+// check-run-results
3
+// exec-env:RUST_BACKTRACE=0
4
+
5
+// Test that we format the panic message only once.
6
+// Regression test for https://github.com/rust-lang/rust/issues/110717
7
8
+use std::fmt;
9
10
+struct PrintOnFmt;
11
12
+impl fmt::Display for PrintOnFmt {
13
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14
+ eprintln!("fmt");
15
+ f.write_str("PrintOnFmt")
16
+ }
17
+}
18
19
+fn main() {
20
+ panic!("{}", PrintOnFmt)
21
tests/ui/panics/fmt-only-once.run.stderr
@@ -0,0 +1,3 @@
+fmt
+thread 'main' panicked at 'PrintOnFmt', $DIR/fmt-only-once.rs:20:5
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
0 commit comments