about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2024-07-05 17:24:10 -0400
committerjyn <github@jyn.dev>2024-07-12 11:52:04 -0400
commit1c8f9bb84d5956abe6671bf77ccaba64505266a5 (patch)
tree392bbbc17025cf590dea0819277c294f6e07149d /tests
parentde14f1f932f4f11130be3fed5cd370bd0936032e (diff)
downloadrust-1c8f9bb84d5956abe6671bf77ccaba64505266a5.tar.gz
rust-1c8f9bb84d5956abe6671bf77ccaba64505266a5.zip
fix interleaved panic output
previously, we only held a lock for printing the backtrace itself. since all threads were printing to the same file descriptor, that meant random output in the default panic hook would be interleaved with the backtrace. now, we hold the lock for the full duration of the hook, and the output is ordered.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/backtrace/synchronized-panic-handler.rs2
-rw-r--r--tests/ui/backtrace/synchronized-panic-handler.run.stderr8
2 files changed, 6 insertions, 4 deletions
diff --git a/tests/ui/backtrace/synchronized-panic-handler.rs b/tests/ui/backtrace/synchronized-panic-handler.rs
index 0ea285968d5..00eb249da1d 100644
--- a/tests/ui/backtrace/synchronized-panic-handler.rs
+++ b/tests/ui/backtrace/synchronized-panic-handler.rs
@@ -1,6 +1,8 @@
 //@ run-pass
 //@ check-run-results
 //@ edition:2021
+//@ exec-env:RUST_BACKTRACE=0
+//@ needs-threads
 use std::thread;
 const PANIC_MESSAGE: &str = "oops oh no woe is me";
 
diff --git a/tests/ui/backtrace/synchronized-panic-handler.run.stderr b/tests/ui/backtrace/synchronized-panic-handler.run.stderr
index 06ef53836c2..b7c815a94c8 100644
--- a/tests/ui/backtrace/synchronized-panic-handler.run.stderr
+++ b/tests/ui/backtrace/synchronized-panic-handler.run.stderr
@@ -1,5 +1,5 @@
-thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:thread '8<unnamed>:5' panicked at :
-oops oh no woe is me$DIR/synchronized-panic-handler.rs
-:note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
-8:5:
+thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:10:5:
+oops oh no woe is me
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread '<unnamed>' panicked at $DIR/synchronized-panic-handler.rs:10:5:
 oops oh no woe is me