run full query stack print just when RUST_BACKTRACE is set
This commit is contained in:
parent
17eb8d8b34
commit
20ea9290ed
3 changed files with 15 additions and 5 deletions
|
@ -1211,7 +1211,10 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
|
||||||
handler.note_without_error(¬e);
|
handler.note_without_error(¬e);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)]
|
#[cfg(windows)]
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -124,7 +124,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
|
pub fn try_print_query_stack(
|
||||||
|
handler: &Handler,
|
||||||
|
num_frames: Option<usize>,
|
||||||
|
backtrace: Option<bool>,
|
||||||
|
) {
|
||||||
eprintln!("query stack during panic:");
|
eprintln!("query stack during panic:");
|
||||||
|
|
||||||
// Be careful reyling on global state here: this code is called from
|
// Be careful reyling on global state here: this code is called from
|
||||||
|
@ -138,7 +142,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|
||||||
while let Some(query) = current_query {
|
while let Some(query) = current_query {
|
||||||
if i == num_frames.unwrap() {
|
if backtrace.unwrap() == false && i == num_frames.unwrap() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let query_info =
|
let query_info =
|
||||||
|
|
|
@ -274,7 +274,10 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
|
||||||
handler.note_without_error(¬e);
|
handler.note_without_error(¬e);
|
||||||
}
|
}
|
||||||
|
|
||||||
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_or(false, |x| &x != "0");
|
||||||
|
|
||||||
|
TyCtxt::try_print_query_stack(&handler, Some(2), Some(backtrace));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<PathBuf> {
|
fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<PathBuf> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue