@@ -6,8 +6,6 @@ use crate::rustc_middle::dep_graph::DepContext;
6
6
use crate :: rustc_middle:: ty:: TyEncoder ;
7
7
use crate :: QueryConfigRestored ;
8
8
use rustc_data_structures:: stable_hasher:: { Hash64 , HashStable , StableHasher } ;
9
- use rustc_data_structures:: sync:: Lock ;
10
- use rustc_errors:: Diagnostic ;
11
9
12
10
use rustc_index:: Idx ;
13
11
use rustc_middle:: dep_graph:: dep_kinds;
@@ -17,7 +15,6 @@ use rustc_middle::dep_graph::{
17
15
use rustc_middle:: query:: on_disk_cache:: AbsoluteBytePos ;
18
16
use rustc_middle:: query:: on_disk_cache:: { CacheDecoder , CacheEncoder , EncodedDepNodeIndex } ;
19
17
use rustc_middle:: query:: Key ;
20
- use rustc_middle:: ty:: tls:: { self , ImplicitCtxt } ;
21
18
use rustc_middle:: ty:: { self , print:: with_no_queries, TyCtxt } ;
22
19
use rustc_query_system:: dep_graph:: { DepNodeParams , HasDepContext } ;
23
20
use rustc_query_system:: ich:: StableHashingContext ;
@@ -31,7 +28,6 @@ use rustc_serialize::Encodable;
31
28
use rustc_session:: Limit ;
32
29
use rustc_span:: def_id:: LOCAL_CRATE ;
33
30
use std:: num:: NonZeroU64 ;
34
- use thin_vec:: ThinVec ;
35
31
36
32
#[ derive( Copy , Clone ) ]
37
33
pub struct QueryCtxt < ' tcx > {
@@ -75,11 +71,6 @@ impl QueryContext for QueryCtxt<'_> {
75
71
)
76
72
}
77
73
78
- #[ inline]
79
- fn current_query_job ( self ) -> Option < QueryJobId > {
80
- tls:: with_context ( |icx| icx. query )
81
- }
82
-
83
74
fn collect_active_jobs ( self ) -> QueryMap {
84
75
let mut jobs = QueryMap :: default ( ) ;
85
76
@@ -119,37 +110,8 @@ impl QueryContext for QueryCtxt<'_> {
119
110
}
120
111
}
121
112
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_context` to relate the 'tcx lifetimes
135
- // when accessing the `ImplicitCtxt`.
136
- tls:: with_context ( 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 ( )
153
115
}
154
116
155
117
fn depth_limit_error ( self , job : QueryJobId ) {
0 commit comments