about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-10-16 02:10:09 +0200
committerGitHub <noreply@github.com>2020-10-16 02:10:09 +0200
commitd2feccc1efcbeff9dfb99daa754b8b47cdac7eaf (patch)
tree0af66af30f207fa392b2e380c28c3dda6e575cb6
parent2c1e8cfc622652ebfb1f0256aa8d2afae91bf416 (diff)
parentab0fc477b8b83cb14c584aca281b16fb5cce4c1a (diff)
downloadrust-d2feccc1efcbeff9dfb99daa754b8b47cdac7eaf.tar.gz
rust-d2feccc1efcbeff9dfb99daa754b8b47cdac7eaf.zip
Rollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk
ICEs should always print the top of the query stack

see #76920
-rw-r--r--src/driver.rs6
-rw-r--r--tests/ui/custom_ice_message.stderr2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/driver.rs b/src/driver.rs
index 377f6d22446..805828eece1 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -277,9 +277,9 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
     // If backtraces are enabled, also print the query stack
     let backtrace = env::var_os("RUST_BACKTRACE").map_or(false, |x| &x != "0");
 
-    if backtrace {
-        TyCtxt::try_print_query_stack(&handler);
-    }
+    let num_frames = if backtrace { None } else { Some(2) };
+
+    TyCtxt::try_print_query_stack(&handler, num_frames);
 }
 
 fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<PathBuf> {
diff --git a/tests/ui/custom_ice_message.stderr b/tests/ui/custom_ice_message.stderr
index a9a65a38c10..a1b8e2ee162 100644
--- a/tests/ui/custom_ice_message.stderr
+++ b/tests/ui/custom_ice_message.stderr
@@ -9,3 +9,5 @@ note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy
 
 note: Clippy version: foo
 
+query stack during panic:
+end of query stack