@@ -6,8 +6,6 @@ use crate::rustc_middle::dep_graph::DepContext;
66use crate :: rustc_middle:: ty:: TyEncoder ;
77use crate :: QueryConfigRestored ;
88use rustc_data_structures:: stable_hasher:: { Hash64 , HashStable , StableHasher } ;
9- use rustc_data_structures:: sync:: Lock ;
10- use rustc_errors:: Diagnostic ;
119
1210use rustc_index:: Idx ;
1311use rustc_middle:: dep_graph:: dep_kinds;
@@ -17,7 +15,6 @@ use rustc_middle::dep_graph::{
1715use rustc_middle:: query:: on_disk_cache:: AbsoluteBytePos ;
1816use rustc_middle:: query:: on_disk_cache:: { CacheDecoder , CacheEncoder , EncodedDepNodeIndex } ;
1917use rustc_middle:: query:: Key ;
20- use rustc_middle:: ty:: tls:: { self , ImplicitCtxt } ;
2118use rustc_middle:: ty:: { self , print:: with_no_queries, TyCtxt } ;
2219use rustc_query_system:: dep_graph:: { DepNodeParams , HasDepContext } ;
2320use rustc_query_system:: ich:: StableHashingContext ;
@@ -31,7 +28,6 @@ use rustc_serialize::Encodable;
3128use rustc_session:: Limit ;
3229use rustc_span:: def_id:: LOCAL_CRATE ;
3330use std:: num:: NonZeroU64 ;
34- use thin_vec:: ThinVec ;
3531
3632#[ derive( Copy , Clone ) ]
3733pub struct QueryCtxt < ' tcx > {
@@ -75,11 +71,6 @@ impl QueryContext for QueryCtxt<'_> {
7571 )
7672 }
7773
78- #[ inline]
79- fn current_query_job ( self ) -> Option < QueryJobId > {
80- tls:: with_related_context ( self . tcx , |icx| icx. query )
81- }
82-
8374 fn collect_active_jobs ( self ) -> QueryMap {
8475 let mut jobs = QueryMap :: default ( ) ;
8576
@@ -119,37 +110,8 @@ impl QueryContext for QueryCtxt<'_> {
119110 }
120111 }
121112
122- /// Executes a job by changing the `ImplicitCtxt` to point to the
123- /// new query job while it executes. It returns the diagnostics
124- /// captured during execution and the actual result.
125- #[ inline( always) ]
126- fn start_query < R > (
127- self ,
128- token : QueryJobId ,
129- depth_limit : bool ,
130- diagnostics : Option < & Lock < ThinVec < Diagnostic > > > ,
131- compute : impl FnOnce ( ) -> R ,
132- ) -> R {
133- // The `TyCtxt` stored in TLS has the same global interner lifetime
134- // as `self`, so we use `with_related_context` to relate the 'tcx lifetimes
135- // when accessing the `ImplicitCtxt`.
136- tls:: with_related_context ( self . tcx , move |current_icx| {
137- if depth_limit && !self . recursion_limit ( ) . value_within_limit ( current_icx. query_depth ) {
138- self . depth_limit_error ( token) ;
139- }
140-
141- // Update the `ImplicitCtxt` to point to our new query job.
142- let new_icx = ImplicitCtxt {
143- tcx : self . tcx ,
144- query : Some ( token) ,
145- diagnostics,
146- query_depth : current_icx. query_depth + depth_limit as usize ,
147- task_deps : current_icx. task_deps ,
148- } ;
149-
150- // Use the `ImplicitCtxt` while we execute the query.
151- tls:: enter_context ( & new_icx, compute)
152- } )
113+ fn recursion_limit ( self ) -> Limit {
114+ self . tcx . recursion_limit ( )
153115 }
154116
155117 fn depth_limit_error ( self , job : QueryJobId ) {
0 commit comments