ICEs should print the top of the query stack

This commit is contained in:
hosseind75 2020-09-19 17:51:24 +04:30 committed by hosseind88
parent be719d11e5
commit 17eb8d8b34
3 changed files with 6 additions and 13 deletions

View file

@ -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