@@ -67,7 +67,7 @@ use rustc_macros::{Decodable, Encodable};
6767use rustc_query_system:: ich:: StableHashingContext ;
6868use rustc_span:: Symbol ;
6969
70- use super :: { DepContext , FingerprintStyle , SerializedDepNodeIndex } ;
70+ use super :: { FingerprintStyle , SerializedDepNodeIndex } ;
7171use crate :: mir:: mono:: MonoItem ;
7272use crate :: ty:: TyCtxt ;
7373
@@ -117,29 +117,25 @@ impl DepNode {
117117 /// Creates a new, parameterless DepNode. This method will assert
118118 /// that the DepNode corresponding to the given DepKind actually
119119 /// does not require any parameters.
120- pub fn new_no_params < Tcx > ( tcx : Tcx , kind : DepKind ) -> DepNode
121- where
122- Tcx : super :: DepContext ,
123- {
120+ pub fn new_no_params < ' tcx > ( tcx : TyCtxt < ' tcx > , kind : DepKind ) -> DepNode {
124121 debug_assert_eq ! ( tcx. fingerprint_style( kind) , FingerprintStyle :: Unit ) ;
125122 DepNode { kind, hash : Fingerprint :: ZERO . into ( ) }
126123 }
127124
128- pub fn construct < Tcx , Key > ( tcx : Tcx , kind : DepKind , arg : & Key ) -> DepNode
125+ pub fn construct < ' tcx , Key > ( tcx : TyCtxt < ' tcx > , kind : DepKind , arg : & Key ) -> DepNode
129126 where
130- Tcx : super :: DepContext ,
131- Key : DepNodeKey < Tcx > ,
127+ Key : DepNodeKey < ' tcx > ,
132128 {
133129 let hash = arg. to_fingerprint ( tcx) ;
134130 let dep_node = DepNode { kind, hash : hash. into ( ) } ;
135131
136132 #[ cfg( debug_assertions) ]
137133 {
138134 if !tcx. fingerprint_style ( kind) . reconstructible ( )
139- && ( tcx. sess ( ) . opts . unstable_opts . incremental_info
140- || tcx. sess ( ) . opts . unstable_opts . query_dep_graph )
135+ && ( tcx. sess . opts . unstable_opts . incremental_info
136+ || tcx. sess . opts . unstable_opts . query_dep_graph )
141137 {
142- tcx. dep_graph ( ) . register_dep_node_debug_str ( dep_node, || arg. to_debug_str ( tcx) ) ;
138+ tcx. dep_graph . register_dep_node_debug_str ( dep_node, || arg. to_debug_str ( tcx) ) ;
143139 }
144140 }
145141
@@ -149,10 +145,11 @@ impl DepNode {
149145 /// Construct a DepNode from the given DepKind and DefPathHash. This
150146 /// method will assert that the given DepKind actually requires a
151147 /// single DefId/DefPathHash parameter.
152- pub fn from_def_path_hash < Tcx > ( tcx : Tcx , def_path_hash : DefPathHash , kind : DepKind ) -> Self
153- where
154- Tcx : super :: DepContext ,
155- {
148+ pub fn from_def_path_hash < ' tcx > (
149+ tcx : TyCtxt < ' tcx > ,
150+ def_path_hash : DefPathHash ,
151+ kind : DepKind ,
152+ ) -> Self {
156153 debug_assert ! ( tcx. fingerprint_style( kind) == FingerprintStyle :: DefPathHash ) ;
157154 DepNode { kind, hash : def_path_hash. 0 . into ( ) }
158155 }
@@ -172,26 +169,26 @@ impl fmt::Debug for DepNode {
172169}
173170
174171/// Trait for query keys as seen by dependency-node tracking.
175- pub trait DepNodeKey < Tcx : DepContext > : fmt:: Debug + Sized {
172+ pub trait DepNodeKey < ' tcx > : fmt:: Debug + Sized {
176173 fn fingerprint_style ( ) -> FingerprintStyle ;
177174
178175 /// This method turns a query key into an opaque `Fingerprint` to be used
179176 /// in `DepNode`.
180- fn to_fingerprint ( & self , _ : Tcx ) -> Fingerprint ;
177+ fn to_fingerprint ( & self , tcx : TyCtxt < ' tcx > ) -> Fingerprint ;
181178
182- fn to_debug_str ( & self , tcx : Tcx ) -> String ;
179+ fn to_debug_str ( & self , tcx : TyCtxt < ' tcx > ) -> String ;
183180
184181 /// This method tries to recover the query key from the given `DepNode`,
185182 /// something which is needed when forcing `DepNode`s during red-green
186183 /// evaluation. The query system will only call this method if
187184 /// `fingerprint_style()` is not `FingerprintStyle::Opaque`.
188185 /// It is always valid to return `None` here, in which case incremental
189186 /// compilation will treat the query as having changed instead of forcing it.
190- fn recover ( tcx : Tcx , dep_node : & DepNode ) -> Option < Self > ;
187+ fn recover ( tcx : TyCtxt < ' tcx > , dep_node : & DepNode ) -> Option < Self > ;
191188}
192189
193190// Blanket impl of `DepNodeKey`, which is specialized by other impls elsewhere.
194- impl < Tcx : DepContext , T > DepNodeKey < Tcx > for T
191+ impl < ' tcx , T > DepNodeKey < ' tcx > for T
195192where
196193 T : for < ' a > HashStable < StableHashingContext < ' a > > + fmt:: Debug ,
197194{
@@ -201,7 +198,7 @@ where
201198 }
202199
203200 #[ inline( always) ]
204- default fn to_fingerprint ( & self , tcx : Tcx ) -> Fingerprint {
201+ default fn to_fingerprint ( & self , tcx : TyCtxt < ' tcx > ) -> Fingerprint {
205202 tcx. with_stable_hashing_context ( |mut hcx| {
206203 let mut hasher = StableHasher :: new ( ) ;
207204 self . hash_stable ( & mut hcx, & mut hasher) ;
@@ -210,15 +207,15 @@ where
210207 }
211208
212209 #[ inline( always) ]
213- default fn to_debug_str ( & self , tcx : Tcx ) -> String {
210+ default fn to_debug_str ( & self , tcx : TyCtxt < ' tcx > ) -> String {
214211 // Make sure to print dep node params with reduced queries since printing
215212 // may themselves call queries, which may lead to (possibly untracked!)
216213 // query cycles.
217214 tcx. with_reduced_queries ( || format ! ( "{self:?}" ) )
218215 }
219216
220217 #[ inline( always) ]
221- default fn recover ( _: Tcx , _: & DepNode ) -> Option < Self > {
218+ default fn recover ( _: TyCtxt < ' tcx > , _: & DepNode ) -> Option < Self > {
222219 None
223220 }
224221}
@@ -228,7 +225,7 @@ where
228225/// Information is retrieved by indexing the `DEP_KINDS` array using the integer value
229226/// of the `DepKind`. Overall, this allows to implement `DepContext` using this manual
230227/// jump table instead of large matches.
231- pub struct DepKindVTable < Tcx : DepContext > {
228+ pub struct DepKindVTable < ' tcx > {
232229 /// Anonymous queries cannot be replayed from one compiler invocation to the next.
233230 /// When their result is needed, it is recomputed. They are useful for fine-grained
234231 /// dependency tracking, and caching within one compiler invocation.
@@ -279,11 +276,12 @@ pub struct DepKindVTable<Tcx: DepContext> {
279276 /// with kind `MirValidated`, we know that the GUID/fingerprint of the `DepNode`
280277 /// is actually a `DefPathHash`, and can therefore just look up the corresponding
281278 /// `DefId` in `tcx.def_path_hash_to_def_id`.
282- pub force_from_dep_node :
283- Option < fn ( tcx : Tcx , dep_node : DepNode , prev_index : SerializedDepNodeIndex ) -> bool > ,
279+ pub force_from_dep_node : Option <
280+ fn ( tcx : TyCtxt < ' tcx > , dep_node : DepNode , prev_index : SerializedDepNodeIndex ) -> bool ,
281+ > ,
284282
285283 /// Invoke a query to put the on-disk cached value in memory.
286- pub try_load_from_on_disk_cache : Option < fn ( Tcx , DepNode ) > ,
284+ pub try_load_from_on_disk_cache : Option < fn ( TyCtxt < ' tcx > , DepNode ) > ,
287285
288286 /// The name of this dep kind.
289287 pub name : & ' static & ' static str ,
0 commit comments