about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhosseind88 <hosseind88@mail.ru>2020-10-08 21:07:12 +0330
committerhosseind88 <hosseind88@mail.ru>2020-10-09 20:57:45 +0330
commit73d8f0045fff127c3bdbf907da7a8c3e07b7145a (patch)
tree374d2129999b4458b8d62221f240298f5b6dcfd6
parent42ebae3175a542c07b75c174bdddb22c6b18b10d (diff)
downloadrust-73d8f0045fff127c3bdbf907da7a8c3e07b7145a.tar.gz
rust-73d8f0045fff127c3bdbf907da7a8c3e07b7145a.zip
change condition for end of query stack message
-rw-r--r--compiler/rustc_middle/src/ty/query/plumbing.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/query/plumbing.rs b/compiler/rustc_middle/src/ty/query/plumbing.rs
index 451ed6506f4..27bf22dac75 100644
--- a/compiler/rustc_middle/src/ty/query/plumbing.rs
+++ b/compiler/rustc_middle/src/ty/query/plumbing.rs
@@ -130,12 +130,12 @@ impl<'tcx> TyCtxt<'tcx> {
         // Be careful reyling on global state here: this code is called from
         // a panic hook, which means that the global `Handler` may be in a weird
         // state if it was responsible for triggering the panic.
+        let mut i = 0;
         ty::tls::with_context_opt(|icx| {
             if let Some(icx) = icx {
                 let query_map = icx.tcx.queries.try_collect_active_jobs();
 
                 let mut current_query = icx.query;
-                let mut i = 0;
 
                 while let Some(query) = current_query {
                     if Some(i) == num_frames {
@@ -166,10 +166,10 @@ impl<'tcx> TyCtxt<'tcx> {
             }
         });
 
-        if num_frames != None {
-            eprintln!("we're just showing a limited slice of the query stack");
-        } else {
+        if num_frames == None || num_frames >= Some(i) {
             eprintln!("end of query stack");
+        } else {
+            eprintln!("we're just showing a limited slice of the query stack");
         }
     }
 }