Skip to content

Commit 99d7b10

Browse files
committed
Make the HashStable impl of Allocation safer for future changes of the type
1 parent cbe8c71 commit 99d7b10

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,15 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::Allocation {
456456
hcx: &mut StableHashingContext<'a>,
457457
hasher: &mut StableHasher<W>,
458458
) {
459-
self.bytes.hash_stable(hcx, hasher);
460-
for reloc in self.relocations.iter() {
459+
trace!("hashing allocation {:?}", self);
460+
let mir::interpret::Allocation { bytes, relocations, undef_mask, align, mutability } = self;
461+
bytes.hash_stable(hcx, hasher);
462+
for reloc in relocations.iter() {
461463
reloc.hash_stable(hcx, hasher);
462464
}
463-
self.undef_mask.hash_stable(hcx, hasher);
464-
self.align.hash_stable(hcx, hasher);
465-
self.mutability.hash_stable(hcx, hasher);
465+
undef_mask.hash_stable(hcx, hasher);
466+
align.hash_stable(hcx, hasher);
467+
mutability.hash_stable(hcx, hasher);
466468
}
467469
}
468470

0 commit comments

Comments
 (0)