]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_query_impl/src/plumbing.rs
Rollup merge of #99198 - RalfJung:alloc-null-ptr, r=JohnTitor
[rust.git] / compiler / rustc_query_impl / src / plumbing.rs
index 3ed6632ba66adfe189b09b3fd16216b974159e63..333dc5aa668b02639020b5694bdd56476cfc6118 100644 (file)
@@ -291,11 +291,12 @@ pub fn $name<$tcx>(tcx: QueryCtxt<$tcx>, key: query_keys::$name<$tcx>) -> QueryS
                         .and_then(|def_id| tcx.opt_def_kind(def_id))
                 };
                 let hash = || {
-                    let mut hcx = tcx.create_stable_hashing_context();
-                    let mut hasher = StableHasher::new();
-                    std::mem::discriminant(&kind).hash_stable(&mut hcx, &mut hasher);
-                    key.hash_stable(&mut hcx, &mut hasher);
-                    hasher.finish::<u64>()
+                    tcx.with_stable_hashing_context(|mut hcx|{
+                        let mut hasher = StableHasher::new();
+                        std::mem::discriminant(&kind).hash_stable(&mut hcx, &mut hasher);
+                        key.hash_stable(&mut hcx, &mut hasher);
+                        hasher.finish::<u64>()
+                    })
                 };
 
                 QueryStackFrame::new(name, description, span, def_kind, hash)
@@ -376,6 +377,17 @@ pub fn Null() -> DepKindStruct {
                 }
             }
 
+            // We use this for the forever-red node.
+            pub fn Red() -> DepKindStruct {
+                DepKindStruct {
+                    is_anon: false,
+                    is_eval_always: false,
+                    fingerprint_style: FingerprintStyle::Unit,
+                    force_from_dep_node: Some(|_, dep_node| bug!("force_from_dep_node: encountered {:?}", dep_node)),
+                    try_load_from_on_disk_cache: None,
+                }
+            }
+
             pub fn TraitSelect() -> DepKindStruct {
                 DepKindStruct {
                     is_anon: true,