Skip to content

Commit 339181a

Browse files
committed
show a message when we are showing limited slice of query stack
1 parent 767e84a commit 339181a

File tree

8 files changed

+13
-6
lines changed

8 files changed

+13
-6
lines changed

compiler/rustc_driver/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
12051205
// If backtraces are enabled, also print the query stack
12061206
let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false);
12071207

1208-
let num_frames = if backtrace { Some(2) } else { None };
1208+
let num_frames = if backtrace { None } else { Some(2) };
12091209

12101210
TyCtxt::try_print_query_stack(&handler, num_frames);
12111211

compiler/rustc_middle/src/ty/query/plumbing.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ impl<'tcx> TyCtxt<'tcx> {
127127
pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
128128
eprintln!("query stack during panic:");
129129

130+
if num_frames != None {
131+
eprintln!("we're just showing a limited slice of the query stack");
132+
}
130133
// Be careful reyling on global state here: this code is called from
131134
// a panic hook, which means that the global `Handler` may be in a weird
132135
// state if it was responsible for triggering the panic.

src/test/ui/consts/const-eval/const-eval-query-stack.stderr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ LL | let x: &'static i32 = &(1 / 0);
1111
query stack during panic:
1212
#0 [const_eval_raw] const-evaluating `main::promoted[1]`
1313
#1 [const_eval_validated] const-evaluating + checking `main::promoted[1]`
14+
#2 [const_eval_validated] const-evaluating + checking `main::promoted[1]`
15+
#3 [normalize_generic_arg_after_erasing_regions] normalizing `main::promoted[1]`
16+
#4 [optimized_mir] optimizing MIR for `main`
17+
#5 [collect_and_partition_mono_items] collect_and_partition_mono_items
1418
end of query stack

src/test/ui/pattern/const-pat-ice.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ note: rustc VERSION running on TARGET
1212
note: compiler flags: FLAGS
1313

1414
query stack during panic:
15+
we're just showing a limited slice of the query stack
1516
#0 [check_match] match-checking `main`
1617
#1 [analysis] running analysis passes on this crate
1718
end of query stack

src/test/ui/proc-macro/invalid-punct-ident-1.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
query stack during panic:
2+
we're just showing a limited slice of the query stack
23
end of query stack
34
error: proc macro panicked
45
--> $DIR/invalid-punct-ident-1.rs:16:1

src/test/ui/proc-macro/invalid-punct-ident-2.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
query stack during panic:
2+
we're just showing a limited slice of the query stack
23
end of query stack
34
error: proc macro panicked
45
--> $DIR/invalid-punct-ident-2.rs:16:1

src/test/ui/proc-macro/invalid-punct-ident-3.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
query stack during panic:
2+
we're just showing a limited slice of the query stack
23
end of query stack
34
error: proc macro panicked
45
--> $DIR/invalid-punct-ident-3.rs:16:1

src/tools/clippy/src/driver.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,7 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
277277
// If backtraces are enabled, also print the query stack
278278
let backtrace = env::var_os("RUST_BACKTRACE").map_or(false, |x| &x != "0");
279279

280-
let num_frames = if backtrace {
281-
Some(2)
282-
} else {
283-
None
284-
};
280+
let num_frames = if backtrace { None } else { Some(2) };
285281

286282
TyCtxt::try_print_query_stack(&handler, num_frames);
287283
}

0 commit comments

Comments
 (0)