diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-01-22 20:37:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-22 20:37:25 +0100 |
| commit | 5fab5429c4a48d606e1722a68eecbd40662daa75 (patch) | |
| tree | 15062726d8f8df0dff0f5b62a43a7d5f345a6664 /compiler/rustc_interface/src/interface.rs | |
| parent | b4266b0bcdbfcf40c3b76f37a9b31dbc3f1992bb (diff) | |
| parent | be56f10a694d4a34c9d02b90f44788040b325a8a (diff) | |
| download | rust-5fab5429c4a48d606e1722a68eecbd40662daa75.tar.gz rust-5fab5429c4a48d606e1722a68eecbd40662daa75.zip | |
Rollup merge of #135596 - compiler-errors:stack, r=oli-obk
Properly note when query stack is being cut off cc #70953 also, i'm not certain whether we should even limit this at all. i don't see the problem with printing the full query stack, apparently it was limited b/c we used to ICE? but we're already printing the full stack to disk since #108714. r? oli-obk
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 1971c637563..308d669cf35 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -533,7 +533,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se pub fn try_print_query_stack( dcx: DiagCtxtHandle<'_>, - num_frames: Option<usize>, + limit_frames: Option<usize>, file: Option<std::fs::File>, ) { eprintln!("query stack during panic:"); @@ -541,13 +541,13 @@ pub fn try_print_query_stack( // Be careful relying on global state here: this code is called from // a panic hook, which means that the global `DiagCtxt` may be in a weird // state if it was responsible for triggering the panic. - let i = ty::tls::with_context_opt(|icx| { + let all_frames = ty::tls::with_context_opt(|icx| { if let Some(icx) = icx { ty::print::with_no_queries!(print_query_stack( QueryCtxt::new(icx.tcx), icx.query, dcx, - num_frames, + limit_frames, file, )) } else { @@ -555,9 +555,14 @@ pub fn try_print_query_stack( } }); - if num_frames == None || num_frames >= Some(i) { - eprintln!("end of query stack"); + if let Some(limit_frames) = limit_frames + && all_frames > limit_frames + { + eprintln!( + "... and {} other queries... use `env RUST_BACKTRACE=1` to see the full query stack", + all_frames - limit_frames + ); } else { - eprintln!("we're just showing a limited slice of the query stack"); + eprintln!("end of query stack"); } } |
