]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_query_system/src/dep_graph/dep_node.rs
Allow to create definitions inside the query system.
[rust.git] / compiler / rustc_query_system / src / dep_graph / dep_node.rs
index c274c2cc26c157008ee9b7eec3d207564cfd385c..c6210095b60fc0153ce9c79a8eb5b9c48b81cdfd 100644 (file)
@@ -131,12 +131,11 @@ impl<Ctxt: DepContext, T> DepNodeParams<Ctxt> for T
 
     #[inline(always)]
     default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint {
-        let mut hcx = tcx.create_stable_hashing_context();
-        let mut hasher = StableHasher::new();
-
-        self.hash_stable(&mut hcx, &mut hasher);
-
-        hasher.finish()
+        tcx.with_stable_hashing_context(|mut hcx| {
+            let mut hasher = StableHasher::new();
+            self.hash_stable(&mut hcx, &mut hasher);
+            hasher.finish()
+        })
     }
 
     #[inline(always)]
@@ -164,7 +163,6 @@ pub struct WorkProductId {
 impl WorkProductId {
     pub fn from_cgu_name(cgu_name: &str) -> WorkProductId {
         let mut hasher = StableHasher::new();
-        cgu_name.len().hash(&mut hasher);
         cgu_name.hash(&mut hasher);
         WorkProductId { hash: hasher.finish() }
     }