mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
ICEs should print the top of the query stack
This commit is contained in:
parent
be719d11e5
commit
17eb8d8b34
@ -1211,12 +1211,7 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
|
||||
handler.note_without_error(¬e);
|
||||
}
|
||||
|
||||
// If backtraces are enabled, also print the query stack
|
||||
let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false);
|
||||
|
||||
if backtrace {
|
||||
TyCtxt::try_print_query_stack(&handler);
|
||||
}
|
||||
TyCtxt::try_print_query_stack(&handler, Some(2));
|
||||
|
||||
#[cfg(windows)]
|
||||
unsafe {
|
||||
|
@ -124,7 +124,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn try_print_query_stack(handler: &Handler) {
|
||||
pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
|
||||
eprintln!("query stack during panic:");
|
||||
|
||||
// Be careful reyling on global state here: this code is called from
|
||||
@ -138,6 +138,9 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
let mut i = 0;
|
||||
|
||||
while let Some(query) = current_query {
|
||||
if i == num_frames.unwrap() {
|
||||
break;
|
||||
}
|
||||
let query_info =
|
||||
if let Some(info) = query_map.as_ref().and_then(|map| map.get(&query)) {
|
||||
info
|
||||
|
@ -274,12 +274,7 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
|
||||
handler.note_without_error(¬e);
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
TyCtxt::try_print_query_stack(&handler, Some(2));
|
||||
}
|
||||
|
||||
fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<PathBuf> {
|
||||
|
Loading…
Reference in New Issue
Block a user