about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/interface.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-22 22:19:08 +0000
committerbors <bors@rust-lang.org>2025-01-22 22:19:08 +0000
commita30f9151fe4a841c4643af4e47ad18a23e1fb044 (patch)
tree38f5de48919ef0899e06d133d16eec4e23b58868 /compiler/rustc_interface/src/interface.rs
parent649b995a9febd658b2570160703dff6fdc038ab2 (diff)
parent3962bfaeedfc89260c0fb9d976489064f8becc02 (diff)
downloadrust-a30f9151fe4a841c4643af4e47ad18a23e1fb044.tar.gz
rust-a30f9151fe4a841c4643af4e47ad18a23e1fb044.zip
Auto merge of #135896 - matthiaskrgr:rollup-g6rv7za, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #132983 (Edit dangling pointers )
 - #135409 (Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block)
 - #135557 (Point at invalid utf-8 span on user's source code)
 - #135596 (Properly note when query stack is being cut off)
 - #135794 (Detect missing fields with default values and suggest `..`)
 - #135814 (ci: use ghcr buildkit image)
 - #135826 (Misc. `rustc_resolve` cleanups)
 - #135837 (Remove test panic from File::open)
 - #135856 (Library: Finalize dyn compatibility renaming)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
-rw-r--r--compiler/rustc_interface/src/interface.rs17
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");
     }
 }