summary refs log tree commit diff
path: root/compiler/rustc_query_impl/src
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-06-27 09:07:14 +0000
committerPhilipp Krones <hello@philkrones.com>2023-06-27 16:12:07 +0200
commitb0142f603dd171dccf822a868284c93b8f6f6f91 (patch)
treecaee3821eb7094fe1855b0d360b1c8788ce1c13f /compiler/rustc_query_impl/src
parent5d3377dd6782b7f609902189eaac0cb31829c4b0 (diff)
downloadrust-b0142f603dd171dccf822a868284c93b8f6f6f91.tar.gz
rust-b0142f603dd171dccf822a868284c93b8f6f6f91.zip
Avoid calling queries during query stack printing
Diffstat (limited to 'compiler/rustc_query_impl/src')
-rw-r--r--compiler/rustc_query_impl/src/plumbing.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs
index cb0df1d1b82..12a3f2ac802 100644
--- a/compiler/rustc_query_impl/src/plumbing.rs
+++ b/compiler/rustc_query_impl/src/plumbing.rs
@@ -16,7 +16,7 @@ use rustc_middle::query::on_disk_cache::AbsoluteBytePos;
 use rustc_middle::query::on_disk_cache::{CacheDecoder, CacheEncoder, EncodedDepNodeIndex};
 use rustc_middle::query::Key;
 use rustc_middle::ty::tls::{self, ImplicitCtxt};
-use rustc_middle::ty::{self, TyCtxt};
+use rustc_middle::ty::{self, print::with_no_queries, TyCtxt};
 use rustc_query_system::dep_graph::{DepNodeParams, HasDepContext};
 use rustc_query_system::ich::StableHashingContext;
 use rustc_query_system::query::{
@@ -312,7 +312,7 @@ pub(crate) fn create_query_frame<
     );
     let description =
         if tcx.sess.verbose() { format!("{description} [{name:?}]") } else { description };
-    let span = if kind == dep_graph::DepKind::def_span {
+    let span = if kind == dep_graph::DepKind::def_span || with_no_queries() {
         // The `def_span` query is used to calculate `default_span`,
         // so exit to avoid infinite recursion.
         None
@@ -320,7 +320,7 @@ pub(crate) fn create_query_frame<
         Some(key.default_span(tcx))
     };
     let def_id = key.key_as_def_id();
-    let def_kind = if kind == dep_graph::DepKind::opt_def_kind {
+    let def_kind = if kind == dep_graph::DepKind::opt_def_kind || with_no_queries() {
         // Try to avoid infinite recursion.
         None
     } else {