Rename HirCtx as Hcx.

PR #154634 recently renamed many type parameters that impl
`HashStableContext` as `Hcx`. It missed a few that are named `HirCtx`.
This commit renames them.
This commit is contained in:
Nicholas Nethercote
2026-04-01 16:38:30 +11:00
parent 48cc71ee88
commit 910677fcc6
2 changed files with 20 additions and 20 deletions
+18 -18
View File
@@ -13,48 +13,48 @@
/// instead of implementing everything in `rustc_middle`.
pub trait HashStableContext: rustc_ast::HashStableContext + rustc_abi::HashStableContext {}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for BodyId {
impl<Hcx: crate::HashStableContext> ToStableHashKey<Hcx> for BodyId {
type KeyType = (DefPathHash, ItemLocalId);
#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> (DefPathHash, ItemLocalId) {
fn to_stable_hash_key(&self, hcx: &Hcx) -> (DefPathHash, ItemLocalId) {
let BodyId { hir_id } = *self;
hir_id.to_stable_hash_key(hcx)
}
}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ItemId {
impl<Hcx: crate::HashStableContext> ToStableHashKey<Hcx> for ItemId {
type KeyType = DefPathHash;
#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
self.owner_id.def_id.to_stable_hash_key(hcx)
}
}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for TraitItemId {
impl<Hcx: crate::HashStableContext> ToStableHashKey<Hcx> for TraitItemId {
type KeyType = DefPathHash;
#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
self.owner_id.def_id.to_stable_hash_key(hcx)
}
}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ImplItemId {
impl<Hcx: crate::HashStableContext> ToStableHashKey<Hcx> for ImplItemId {
type KeyType = DefPathHash;
#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
self.owner_id.def_id.to_stable_hash_key(hcx)
}
}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId {
impl<Hcx: crate::HashStableContext> ToStableHashKey<Hcx> for ForeignItemId {
type KeyType = DefPathHash;
#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
self.owner_id.def_id.to_stable_hash_key(hcx)
}
}
@@ -66,8 +66,8 @@ fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
// want to pick up on a reference changing its target, so we hash the NodeIds
// in "DefPath Mode".
impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for OwnerNodes<'tcx> {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
impl<'tcx, Hcx: crate::HashStableContext> HashStable<Hcx> for OwnerNodes<'tcx> {
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
// We ignore the `nodes` and `bodies` fields since these refer to information included in
// `hash` which is hashed in the collector and used for the crate hash.
// `local_id_to_def_id` is also ignored because is dependent on the body, then just hashing
@@ -78,15 +78,15 @@ fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
}
}
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for DelayedLints {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
impl<Hcx: crate::HashStableContext> HashStable<Hcx> for DelayedLints {
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
let DelayedLints { opt_hash, .. } = *self;
opt_hash.unwrap().hash_stable(hcx, hasher);
}
}
impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for AttributeMap<'tcx> {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
impl<'tcx, Hcx: crate::HashStableContext> HashStable<Hcx> for AttributeMap<'tcx> {
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
// We ignore the `map` since it refers to information included in `opt_hash` which is
// hashed in the collector and used for the crate hash.
let AttributeMap { opt_hash, define_opaque: _, map: _ } = *self;
@@ -94,8 +94,8 @@ fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
}
}
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for HashIgnoredAttrId {
fn hash_stable(&self, _hcx: &mut HirCtx, _hasher: &mut StableHasher) {
impl<Hcx: crate::HashStableContext> HashStable<Hcx> for HashIgnoredAttrId {
fn hash_stable(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) {
/* we don't hash HashIgnoredAttrId, we ignore them */
}
}
+2 -2
View File
@@ -77,8 +77,8 @@ pub fn owner(&self, tcx: TyCtxt<'hir>, def_id: LocalDefId) -> MaybeOwner<'hir> {
}
}
impl<HirCtx: HashStableContext> HashStable<HirCtx> for Crate<'_> {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
impl<Hcx: HashStableContext> HashStable<Hcx> for Crate<'_> {
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
let Crate { opt_hir_hash, .. } = self;
opt_hir_hash.unwrap().hash_stable(hcx, hasher)
}