Ensure define_opaque is accounted for in HIR hash
This commit is contained in:
parent
48994b1674
commit
4b22ac5296
4 changed files with 28 additions and 3 deletions
|
@ -14,7 +14,7 @@ use rustc_hir::def::DefKind;
|
|||
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
|
||||
use rustc_hir::*;
|
||||
use rustc_macros::{Decodable, Encodable, HashStable};
|
||||
use rustc_span::{ErrorGuaranteed, ExpnId};
|
||||
use rustc_span::{ErrorGuaranteed, ExpnId, Span};
|
||||
|
||||
use crate::query::Providers;
|
||||
use crate::ty::{EarlyBinder, ImplSubject, TyCtxt};
|
||||
|
@ -157,6 +157,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
node: OwnerNode<'_>,
|
||||
bodies: &SortedMap<ItemLocalId, &Body<'_>>,
|
||||
attrs: &SortedMap<ItemLocalId, &[Attribute]>,
|
||||
define_opaque: Option<&[(Span, LocalDefId)]>,
|
||||
) -> (Option<Fingerprint>, Option<Fingerprint>) {
|
||||
if self.needs_crate_hash() {
|
||||
self.with_stable_hashing_context(|mut hcx| {
|
||||
|
@ -168,6 +169,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
let mut stable_hasher = StableHasher::new();
|
||||
attrs.hash_stable(&mut hcx, &mut stable_hasher);
|
||||
|
||||
// Hash the defined opaque types, which are not present in the attrs.
|
||||
define_opaque.hash_stable(&mut hcx, &mut stable_hasher);
|
||||
|
||||
let h2 = stable_hasher.finish();
|
||||
(Some(h1), Some(h2))
|
||||
})
|
||||
|
|
|
@ -1288,7 +1288,8 @@ impl<'tcx> TyCtxtFeed<'tcx, LocalDefId> {
|
|||
let bodies = Default::default();
|
||||
let attrs = hir::AttributeMap::EMPTY;
|
||||
|
||||
let (opt_hash_including_bodies, _) = self.tcx.hash_owner_nodes(node, &bodies, &attrs.map);
|
||||
let (opt_hash_including_bodies, _) =
|
||||
self.tcx.hash_owner_nodes(node, &bodies, &attrs.map, attrs.define_opaque);
|
||||
let node = node.into();
|
||||
self.opt_hir_owner_nodes(Some(self.tcx.arena.alloc(hir::OwnerNodes {
|
||||
opt_hash_including_bodies,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue