1 //! This module contains `HashStable` implementations for various HIR data
2 //! types in no particular order.
4 use crate::ich::hcx::BodyResolver;
5 use crate::ich::StableHashingContext;
6 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
9 impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> {
11 fn hash_body_id(&mut self, id: hir::BodyId, hasher: &mut StableHasher) {
13 match hcx.body_resolver {
14 BodyResolver::Forbidden => panic!("Hashing HIR bodies is forbidden."),
15 BodyResolver::Ignore => {}
16 BodyResolver::Traverse { owner, bodies } => {
17 assert_eq!(id.hir_id.owner, owner);
18 bodies[&id.hir_id.local_id].hash_stable(hcx, hasher);