about summary refs log tree commit diff
path: root/src/librustc_driver
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-29 04:36:01 +0200
committerGitHub <noreply@github.com>2019-09-29 04:36:01 +0200
commitb30d9beafbedb898253a3103ff6afd9f034149f4 (patch)
treea2805dc20aec6bff6618a21495ca632709979806 /src/librustc_driver
parenta874c659c89ede39068d01f9f799f07084161c15 (diff)
parent97906bcd5c9c5ba5d165c7330b2ee062a97f11cf (diff)
downloadrust-b30d9beafbedb898253a3103ff6afd9f034149f4.tar.gz
rust-b30d9beafbedb898253a3103ff6afd9f034149f4.zip
Rollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum
Fix double panic when printing query stack during an ICE

On the latest nightly, any call to `bug` or `span_bug` will result in two panics - the first one as a normal result of calling `bug` / `span_bug`, and the second as a result of trying to print the query stack from the panic handler. This is caused by the query-printing code attempting to acquire a lock on `HandlerInnder`, which is still being held by `bug`.

This PR moves the actual panic out of `HandlerInner`, into `Handler`. This allows us to release the lock on `HandlerInner` before triggering the panic, ensuring that the panic handler will be able to acquire the lock if necessary.
Diffstat (limited to 'src/librustc_driver')
-rw-r--r--src/librustc_driver/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 774a5af1b1c..dd088b68a23 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -1231,7 +1231,7 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
     let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false);
 
     if backtrace {
-        TyCtxt::try_print_query_stack();
+        TyCtxt::try_print_query_stack(&handler);
     }
 
     #[cfg(windows)]