run full query stack print just when RUST_BACKTRACE is set

This commit is contained in:
hosseind75 2020-09-19 18:37:58 +04:30 committed by hosseind88
parent 17eb8d8b34
commit 20ea9290ed
3 changed files with 15 additions and 5 deletions

View file

@ -1211,7 +1211,10 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
handler.note_without_error(&note);
}
TyCtxt::try_print_query_stack(&handler, Some(2));
// If backtraces are enabled, also print the query stack
let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false);
TyCtxt::try_print_query_stack(&handler, Some(2), Some(backtrace));
#[cfg(windows)]
unsafe {