Skip to content

Commit

Permalink
move item reference comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Feb 5, 2020
1 parent 28b0ed0 commit e8b72f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/librustc/ich/impls_hir.rs
Expand Up @@ -40,13 +40,6 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
}
}

// The following implementations of HashStable for `ItemId`, `TraitItemId`, and
// `ImplItemId` deserve special attention. Normally we do not hash `NodeId`s within
// the HIR, since they just signify a HIR nodes own path. But `ItemId` et al
// are used when another item in the HIR is *referenced* and we certainly
// want to pick up on a reference changing its target, so we hash the NodeIds
// in "DefPath Mode".

fn hash_reference_to_item(&mut self, id: hir::HirId, hasher: &mut StableHasher) {
let hcx = self;

Expand Down
7 changes: 7 additions & 0 deletions src/librustc_hir/stable_hash_impls.rs
Expand Up @@ -36,6 +36,13 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for BodyId {
}
}

// The following implementations of HashStable for `ItemId`, `TraitItemId`, and
// `ImplItemId` deserve special attention. Normally we do not hash `NodeId`s within
// the HIR, since they just signify a HIR nodes own path. But `ItemId` et al
// are used when another item in the HIR is *referenced* and we certainly
// want to pick up on a reference changing its target, so we hash the NodeIds
// in "DefPath Mode".

impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for ItemId {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
hcx.hash_reference_to_item(self.id, hasher)
Expand Down

0 comments on commit e8b72f4

Please sign in to comment.