@@ -51,14 +51,14 @@ use std::fmt;
5151use std:: hash:: Hash ;
5252
5353use rustc_data_structures:: fingerprint:: { Fingerprint , PackedFingerprint } ;
54- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher , StableOrd , ToStableHashKey } ;
54+ use rustc_data_structures:: stable_hasher:: { StableHasher , StableOrd , ToStableHashKey } ;
5555use rustc_hir:: def_id:: DefId ;
5656use rustc_hir:: definitions:: DefPathHash ;
5757use rustc_macros:: { Decodable , Encodable , HashStable } ;
5858use rustc_span:: Symbol ;
5959
6060use super :: { KeyFingerprintStyle , SerializedDepNodeIndex } ;
61- use crate :: ich :: StableHashingContext ;
61+ use crate :: dep_graph :: DepNodeKey ;
6262use crate :: mir:: mono:: MonoItem ;
6363use crate :: ty:: { TyCtxt , tls} ;
6464
@@ -168,58 +168,6 @@ impl fmt::Debug for DepNode {
168168 }
169169}
170170
171- /// Trait for query keys as seen by dependency-node tracking.
172- pub trait DepNodeKey < ' tcx > : fmt:: Debug + Sized {
173- fn key_fingerprint_style ( ) -> KeyFingerprintStyle ;
174-
175- /// This method turns a query key into an opaque `Fingerprint` to be used
176- /// in `DepNode`.
177- fn to_fingerprint ( & self , tcx : TyCtxt < ' tcx > ) -> Fingerprint ;
178-
179- fn to_debug_str ( & self , tcx : TyCtxt < ' tcx > ) -> String ;
180-
181- /// This method tries to recover the query key from the given `DepNode`,
182- /// something which is needed when forcing `DepNode`s during red-green
183- /// evaluation. The query system will only call this method if
184- /// `fingerprint_style()` is not `FingerprintStyle::Opaque`.
185- /// It is always valid to return `None` here, in which case incremental
186- /// compilation will treat the query as having changed instead of forcing it.
187- fn try_recover_key ( tcx : TyCtxt < ' tcx > , dep_node : & DepNode ) -> Option < Self > ;
188- }
189-
190- // Blanket impl of `DepNodeKey`, which is specialized by other impls elsewhere.
191- impl < ' tcx , T > DepNodeKey < ' tcx > for T
192- where
193- T : for < ' a > HashStable < StableHashingContext < ' a > > + fmt:: Debug ,
194- {
195- #[ inline( always) ]
196- default fn key_fingerprint_style ( ) -> KeyFingerprintStyle {
197- KeyFingerprintStyle :: Opaque
198- }
199-
200- #[ inline( always) ]
201- default fn to_fingerprint ( & self , tcx : TyCtxt < ' tcx > ) -> Fingerprint {
202- tcx. with_stable_hashing_context ( |mut hcx| {
203- let mut hasher = StableHasher :: new ( ) ;
204- self . hash_stable ( & mut hcx, & mut hasher) ;
205- hasher. finish ( )
206- } )
207- }
208-
209- #[ inline( always) ]
210- default fn to_debug_str ( & self , tcx : TyCtxt < ' tcx > ) -> String {
211- // Make sure to print dep node params with reduced queries since printing
212- // may themselves call queries, which may lead to (possibly untracked!)
213- // query cycles.
214- tcx. with_reduced_queries ( || format ! ( "{self:?}" ) )
215- }
216-
217- #[ inline( always) ]
218- default fn try_recover_key ( _: TyCtxt < ' tcx > , _: & DepNode ) -> Option < Self > {
219- None
220- }
221- }
222-
223171/// This struct stores function pointers and other metadata for a particular DepKind.
224172///
225173/// Information is retrieved by indexing the `DEP_KINDS` array using the integer value
0 commit comments