1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! This module contains `HashStable` implementations for various HIR data
12 //! types in no particular order.
15 use hir::map::DefPathHash;
16 use hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX};
17 use ich::{StableHashingContext, NodeIdHashingMode};
18 use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
19 StableHasher, StableHasherResult};
23 impl<'gcx> HashStable<StableHashingContext<'gcx>> for DefId {
25 fn hash_stable<W: StableHasherResult>(&self,
26 hcx: &mut StableHashingContext<'gcx>,
27 hasher: &mut StableHasher<W>) {
28 hcx.def_path_hash(*self).hash_stable(hcx, hasher);
32 impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for DefId {
33 type KeyType = DefPathHash;
36 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash {
37 hcx.def_path_hash(*self)
41 impl<'gcx> HashStable<StableHashingContext<'gcx>> for CrateNum {
43 fn hash_stable<W: StableHasherResult>(&self,
44 hcx: &mut StableHashingContext<'gcx>,
45 hasher: &mut StableHasher<W>) {
46 hcx.def_path_hash(DefId {
48 index: CRATE_DEF_INDEX
49 }).hash_stable(hcx, hasher);
53 impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for CrateNum {
54 type KeyType = DefPathHash;
57 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash {
58 let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX };
59 def_id.to_stable_hash_key(hcx)
63 impl_stable_hash_for!(tuple_struct hir::ItemLocalId { index });
65 impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>>
66 for hir::ItemLocalId {
67 type KeyType = hir::ItemLocalId;
70 fn to_stable_hash_key(&self,
71 _: &StableHashingContext<'gcx>)
77 // The following implementations of HashStable for ItemId, TraitItemId, and
78 // ImplItemId deserve special attention. Normally we do not hash NodeIds within
79 // the HIR, since they just signify a HIR nodes own path. But ItemId et al
80 // are used when another item in the HIR is *referenced* and we certainly
81 // want to pick up on a reference changing its target, so we hash the NodeIds
84 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ItemId {
85 fn hash_stable<W: StableHasherResult>(&self,
86 hcx: &mut StableHashingContext<'gcx>,
87 hasher: &mut StableHasher<W>) {
92 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
93 id.hash_stable(hcx, hasher);
98 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItemId {
99 fn hash_stable<W: StableHasherResult>(&self,
100 hcx: &mut StableHashingContext<'gcx>,
101 hasher: &mut StableHasher<W>) {
102 let hir::TraitItemId {
106 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
107 node_id.hash_stable(hcx, hasher);
112 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItemId {
113 fn hash_stable<W: StableHasherResult>(&self,
114 hcx: &mut StableHashingContext<'gcx>,
115 hasher: &mut StableHasher<W>) {
116 let hir::ImplItemId {
120 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
121 node_id.hash_stable(hcx, hasher);
126 impl_stable_hash_for!(struct hir::Lifetime {
132 impl_stable_hash_for!(struct hir::LifetimeDef {
138 impl_stable_hash_for!(struct hir::Path {
144 impl_stable_hash_for!(struct hir::PathSegment {
149 impl_stable_hash_for!(struct hir::PathParameters {
157 impl_stable_hash_for!(enum hir::TyParamBound {
158 TraitTyParamBound(poly_trait_ref, trait_bound_modifier),
159 RegionTyParamBound(lifetime)
162 impl_stable_hash_for!(enum hir::TraitBoundModifier {
167 impl_stable_hash_for!(struct hir::TyParam {
176 impl_stable_hash_for!(struct hir::Generics {
183 impl_stable_hash_for!(struct hir::WhereClause {
188 impl_stable_hash_for!(enum hir::WherePredicate {
189 BoundPredicate(pred),
190 RegionPredicate(pred),
194 impl_stable_hash_for!(struct hir::WhereBoundPredicate {
201 impl_stable_hash_for!(struct hir::WhereRegionPredicate {
207 impl_stable_hash_for!(struct hir::WhereEqPredicate {
214 impl_stable_hash_for!(struct hir::MutTy {
219 impl_stable_hash_for!(struct hir::MethodSig {
227 impl_stable_hash_for!(struct hir::TypeBinding {
234 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Ty {
235 fn hash_stable<W: StableHasherResult>(&self,
236 hcx: &mut StableHashingContext<'gcx>,
237 hasher: &mut StableHasher<W>) {
238 hcx.while_hashing_hir_bodies(true, |hcx| {
245 node.hash_stable(hcx, hasher);
246 span.hash_stable(hcx, hasher);
251 impl_stable_hash_for!(enum hir::PrimTy {
260 impl_stable_hash_for!(struct hir::BareFnTy {
267 impl_stable_hash_for!(enum hir::Ty_ {
276 TyTraitObject(trait_refs, lifetime),
283 impl_stable_hash_for!(struct hir::FnDecl {
290 impl_stable_hash_for!(enum hir::FunctionRetTy {
295 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitRef {
296 fn hash_stable<W: StableHasherResult>(&self,
297 hcx: &mut StableHashingContext<'gcx>,
298 hasher: &mut StableHasher<W>) {
301 // Don't hash the ref_id. It is tracked via the thing it is used to access
305 path.hash_stable(hcx, hasher);
310 impl_stable_hash_for!(struct hir::PolyTraitRef {
316 impl_stable_hash_for!(enum hir::QPath {
318 TypeRelative(t, path_segment)
321 impl_stable_hash_for!(struct hir::MacroDef {
332 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Block {
333 fn hash_stable<W: StableHasherResult>(&self,
334 hcx: &mut StableHashingContext<'gcx>,
335 hasher: &mut StableHasher<W>) {
346 let non_item_stmts = || stmts.iter().filter(|stmt| {
348 hir::StmtDecl(ref decl, _) => {
350 // If this is a declaration of a nested item, we don't
351 // want to leave any trace of it in the hash value, not
352 // even that it exists. Otherwise changing the position
353 // of nested items would invalidate the containing item
354 // even though that does not constitute a semantic
356 hir::DeclItem(_) => false,
357 hir::DeclLocal(_) => true
361 hir::StmtSemi(..) => true
365 let count = non_item_stmts().count();
367 count.hash_stable(hcx, hasher);
369 for stmt in non_item_stmts() {
370 stmt.hash_stable(hcx, hasher);
373 expr.hash_stable(hcx, hasher);
374 rules.hash_stable(hcx, hasher);
375 span.hash_stable(hcx, hasher);
376 targeted_by_break.hash_stable(hcx, hasher);
380 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Pat {
381 fn hash_stable<W: StableHasherResult>(&self,
382 hcx: &mut StableHashingContext<'gcx>,
383 hasher: &mut StableHasher<W>) {
392 node.hash_stable(hcx, hasher);
393 span.hash_stable(hcx, hasher);
397 impl_stable_hash_for_spanned!(hir::FieldPat);
398 impl_stable_hash_for!(struct hir::FieldPat {
404 impl_stable_hash_for!(enum hir::BindingAnnotation {
411 impl_stable_hash_for!(enum hir::RangeEnd {
416 impl_stable_hash_for!(enum hir::PatKind {
418 Binding(binding_mode, var, name, sub),
419 Struct(path, field_pats, dotdot),
420 TupleStruct(path, field_pats, dotdot),
422 Tuple(field_pats, dotdot),
424 Ref(sub, mutability),
426 Range(start, end, end_kind),
427 Slice(one, two, three)
430 impl_stable_hash_for!(enum hir::BinOp_ {
451 impl_stable_hash_for_spanned!(hir::BinOp_);
453 impl_stable_hash_for!(enum hir::UnOp {
459 impl_stable_hash_for_spanned!(hir::Stmt_);
461 impl_stable_hash_for!(struct hir::Local {
472 impl_stable_hash_for_spanned!(hir::Decl_);
473 impl_stable_hash_for!(enum hir::Decl_ {
478 impl_stable_hash_for!(struct hir::Arm {
485 impl_stable_hash_for!(struct hir::Field {
492 impl_stable_hash_for_spanned!(ast::Name);
495 impl_stable_hash_for!(enum hir::BlockCheckMode {
498 PushUnsafeBlock(src),
502 impl_stable_hash_for!(enum hir::UnsafeSource {
507 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Expr {
508 fn hash_stable<W: StableHasherResult>(&self,
509 hcx: &mut StableHashingContext<'gcx>,
510 hasher: &mut StableHasher<W>) {
511 hcx.while_hashing_hir_bodies(true, |hcx| {
520 let spans_always_on = match *node {
531 hir::ExprClosure(..) |
533 hir::ExprAssign(..) |
534 hir::ExprTupField(..) |
535 hir::ExprAddrOf(..) |
540 hir::ExprInlineAsm(..) |
541 hir::ExprRepeat(..) |
543 hir::ExprMethodCall(..) |
545 hir::ExprStruct(..) |
546 hir::ExprField(..) => {
547 // For these we only hash the span when debuginfo is on.
550 // For the following, spans might be significant because of
551 // panic messages indicating the source location.
552 hir::ExprBinary(op, ..) => {
553 hcx.binop_can_panic_at_runtime(op.node)
555 hir::ExprUnary(op, _) => {
556 hcx.unop_can_panic_at_runtime(op)
558 hir::ExprAssignOp(op, ..) => {
559 hcx.binop_can_panic_at_runtime(op.node)
561 hir::ExprIndex(..) => {
567 hcx.while_hashing_spans(true, |hcx| {
568 span.hash_stable(hcx, hasher);
569 node.hash_stable(hcx, hasher);
570 attrs.hash_stable(hcx, hasher);
573 span.hash_stable(hcx, hasher);
574 node.hash_stable(hcx, hasher);
575 attrs.hash_stable(hcx, hasher);
581 impl_stable_hash_for!(enum hir::Expr_ {
584 ExprCall(callee, args),
585 ExprMethodCall(segment, span, args),
587 ExprBinary(op, lhs, rhs),
588 ExprUnary(op, operand),
592 ExprIf(cond, then, els),
593 ExprWhile(cond, body, label),
594 ExprLoop(body, label, loop_src),
595 ExprMatch(matchee, arms, match_src),
596 ExprClosure(capture_clause, decl, body_id, span, gen),
598 ExprAssign(lhs, rhs),
599 ExprAssignOp(op, lhs, rhs),
600 ExprField(owner, field_name),
601 ExprTupField(owner, idx),
604 ExprAddrOf(mutability, sub),
605 ExprBreak(destination, sub),
606 ExprAgain(destination),
608 ExprInlineAsm(asm, inputs, outputs),
609 ExprStruct(path, fields, base),
610 ExprRepeat(val, times),
614 impl_stable_hash_for!(enum hir::LocalSource {
619 impl_stable_hash_for!(enum hir::LoopSource {
625 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::MatchSource {
626 fn hash_stable<W: StableHasherResult>(&self,
627 hcx: &mut StableHashingContext<'gcx>,
628 hasher: &mut StableHasher<W>) {
629 use hir::MatchSource;
631 mem::discriminant(self).hash_stable(hcx, hasher);
633 MatchSource::Normal |
634 MatchSource::WhileLetDesugar |
635 MatchSource::ForLoopDesugar |
636 MatchSource::TryDesugar => {
637 // No fields to hash.
639 MatchSource::IfLetDesugar { contains_else_clause } => {
640 contains_else_clause.hash_stable(hcx, hasher);
646 impl_stable_hash_for!(enum hir::CaptureClause {
651 impl_stable_hash_for_spanned!(usize);
653 impl_stable_hash_for!(struct hir::Destination {
658 impl_stable_hash_for_spanned!(ast::Ident);
660 impl_stable_hash_for!(enum hir::LoopIdResult {
665 impl_stable_hash_for!(enum hir::LoopIdError {
667 UnlabeledCfInWhileCondition,
671 impl_stable_hash_for!(enum hir::ScopeTarget {
676 impl<'gcx> HashStable<StableHashingContext<'gcx>> for ast::Ident {
677 fn hash_stable<W: StableHasherResult>(&self,
678 hcx: &mut StableHashingContext<'gcx>,
679 hasher: &mut StableHasher<W>) {
682 ctxt: _ // Ignore this
685 name.hash_stable(hcx, hasher);
689 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItem {
690 fn hash_stable<W: StableHasherResult>(&self,
691 hcx: &mut StableHashingContext<'gcx>,
692 hasher: &mut StableHasher<W>) {
702 hcx.hash_hir_item_like(attrs, |hcx| {
703 id.hash_stable(hcx, hasher);
704 name.hash_stable(hcx, hasher);
705 attrs.hash_stable(hcx, hasher);
706 node.hash_stable(hcx, hasher);
707 span.hash_stable(hcx, hasher);
712 impl_stable_hash_for!(enum hir::TraitMethod {
717 impl_stable_hash_for!(enum hir::TraitItemKind {
723 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItem {
724 fn hash_stable<W: StableHasherResult>(&self,
725 hcx: &mut StableHashingContext<'gcx>,
726 hasher: &mut StableHasher<W>) {
738 hcx.hash_hir_item_like(attrs, |hcx| {
739 id.hash_stable(hcx, hasher);
740 name.hash_stable(hcx, hasher);
741 vis.hash_stable(hcx, hasher);
742 defaultness.hash_stable(hcx, hasher);
743 attrs.hash_stable(hcx, hasher);
744 node.hash_stable(hcx, hasher);
745 span.hash_stable(hcx, hasher);
750 impl_stable_hash_for!(enum hir::ImplItemKind {
756 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Visibility {
757 fn hash_stable<W: StableHasherResult>(&self,
758 hcx: &mut StableHashingContext<'gcx>,
759 hasher: &mut StableHasher<W>) {
760 mem::discriminant(self).hash_stable(hcx, hasher);
762 hir::Visibility::Public |
763 hir::Visibility::Crate |
764 hir::Visibility::Inherited => {
765 // No fields to hash.
767 hir::Visibility::Restricted { ref path, id } => {
768 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
769 id.hash_stable(hcx, hasher);
771 path.hash_stable(hcx, hasher);
777 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Defaultness {
778 fn hash_stable<W: StableHasherResult>(&self,
779 hcx: &mut StableHashingContext<'gcx>,
780 hasher: &mut StableHasher<W>) {
781 mem::discriminant(self).hash_stable(hcx, hasher);
783 hir::Defaultness::Final => {
784 // No fields to hash.
786 hir::Defaultness::Default { has_value } => {
787 has_value.hash_stable(hcx, hasher);
793 impl_stable_hash_for!(enum hir::ImplPolarity {
798 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Mod {
799 fn hash_stable<W: StableHasherResult>(&self,
800 hcx: &mut StableHashingContext<'gcx>,
801 hasher: &mut StableHasher<W>) {
804 // We are not hashing the IDs of the items contained in the module.
805 // This is harmless and matches the current behavior but it's not
806 // actually correct. See issue #40876.
810 inner.hash_stable(hcx, hasher);
814 impl_stable_hash_for!(struct hir::ForeignMod {
819 impl_stable_hash_for!(struct hir::EnumDef {
823 impl_stable_hash_for!(struct hir::Variant_ {
830 impl_stable_hash_for_spanned!(hir::Variant_);
832 impl_stable_hash_for!(enum hir::UseKind {
838 impl_stable_hash_for!(struct hir::StructField {
847 impl_stable_hash_for!(enum hir::VariantData {
853 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
854 fn hash_stable<W: StableHasherResult>(&self,
855 hcx: &mut StableHashingContext<'gcx>,
856 hasher: &mut StableHasher<W>) {
857 let hash_spans = match self.node {
858 hir::ItemStatic(..) |
864 hir::ItemExternCrate(..) |
865 hir::ItemForeignMod(..) |
866 hir::ItemGlobalAsm(..) |
868 hir::ItemDefaultImpl(..) |
873 hir::ItemStruct(..) |
874 hir::ItemUnion(..) => {
889 hcx.hash_hir_item_like(attrs, |hcx| {
890 hcx.while_hashing_spans(hash_spans, |hcx| {
891 name.hash_stable(hcx, hasher);
892 attrs.hash_stable(hcx, hasher);
893 node.hash_stable(hcx, hasher);
894 vis.hash_stable(hcx, hasher);
895 span.hash_stable(hcx, hasher);
901 impl_stable_hash_for!(enum hir::Item_ {
902 ItemExternCrate(name),
903 ItemUse(path, use_kind),
904 ItemStatic(ty, mutability, body_id),
905 ItemConst(ty, body_id),
906 ItemFn(fn_decl, unsafety, constness, abi, generics, body_id),
908 ItemForeignMod(foreign_mod),
909 ItemGlobalAsm(global_asm),
910 ItemTy(ty, generics),
911 ItemEnum(enum_def, generics),
912 ItemStruct(variant_data, generics),
913 ItemUnion(variant_data, generics),
914 ItemTrait(unsafety, generics, bounds, item_refs),
915 ItemDefaultImpl(unsafety, trait_ref),
916 ItemImpl(unsafety, impl_polarity, impl_defaultness, generics, trait_ref, ty, impl_item_refs)
919 impl_stable_hash_for!(struct hir::TraitItemRef {
927 impl_stable_hash_for!(struct hir::ImplItemRef {
936 impl<'gcx> HashStable<StableHashingContext<'gcx>>
937 for hir::AssociatedItemKind {
938 fn hash_stable<W: StableHasherResult>(&self,
939 hcx: &mut StableHashingContext<'gcx>,
940 hasher: &mut StableHasher<W>) {
941 mem::discriminant(self).hash_stable(hcx, hasher);
943 hir::AssociatedItemKind::Const |
944 hir::AssociatedItemKind::Type => {
945 // No fields to hash.
947 hir::AssociatedItemKind::Method { has_self } => {
948 has_self.hash_stable(hcx, hasher);
954 impl_stable_hash_for!(struct hir::ForeignItem {
963 impl_stable_hash_for!(enum hir::ForeignItem_ {
964 ForeignItemFn(fn_decl, arg_names, generics),
965 ForeignItemStatic(ty, is_mutbl)
968 impl_stable_hash_for!(enum hir::Stmt_ {
974 impl_stable_hash_for!(struct hir::Arg {
980 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Body {
981 fn hash_stable<W: StableHasherResult>(&self,
982 hcx: &mut StableHashingContext<'gcx>,
983 hasher: &mut StableHasher<W>) {
990 hcx.with_node_id_hashing_mode(NodeIdHashingMode::Ignore, |hcx| {
991 arguments.hash_stable(hcx, hasher);
992 value.hash_stable(hcx, hasher);
993 is_generator.hash_stable(hcx, hasher);
998 impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>> for hir::BodyId {
999 type KeyType = (DefPathHash, hir::ItemLocalId);
1002 fn to_stable_hash_key(&self,
1003 hcx: &StableHashingContext<'gcx>)
1004 -> (DefPathHash, hir::ItemLocalId) {
1005 let hir::BodyId { node_id } = *self;
1006 node_id.to_stable_hash_key(hcx)
1010 impl_stable_hash_for!(struct hir::InlineAsmOutput {
1016 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::GlobalAsm {
1017 fn hash_stable<W: StableHasherResult>(&self,
1018 hcx: &mut StableHashingContext<'gcx>,
1019 hasher: &mut StableHasher<W>) {
1020 let hir::GlobalAsm {
1025 asm.hash_stable(hcx, hasher);
1029 impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::InlineAsm {
1030 fn hash_stable<W: StableHasherResult>(&self,
1031 hcx: &mut StableHashingContext<'gcx>,
1032 hasher: &mut StableHasher<W>) {
1033 let hir::InlineAsm {
1042 ctxt: _, // This is used for error reporting
1045 asm.hash_stable(hcx, hasher);
1046 asm_str_style.hash_stable(hcx, hasher);
1047 outputs.hash_stable(hcx, hasher);
1048 inputs.hash_stable(hcx, hasher);
1049 clobbers.hash_stable(hcx, hasher);
1050 volatile.hash_stable(hcx, hasher);
1051 alignstack.hash_stable(hcx, hasher);
1052 dialect.hash_stable(hcx, hasher);
1056 impl_stable_hash_for!(enum hir::def::CtorKind {
1062 impl_stable_hash_for!(enum hir::def::Def {
1070 AssociatedTy(def_id),
1073 SelfTy(trait_def_id, impl_def_id),
1076 Static(def_id, is_mutbl),
1077 StructCtor(def_id, ctor_kind),
1078 VariantCtor(def_id, ctor_kind),
1080 AssociatedConst(def_id),
1082 Upvar(def_id, index, expr_id),
1084 Macro(def_id, macro_kind),
1089 impl_stable_hash_for!(enum hir::Mutability {
1095 impl_stable_hash_for!(enum hir::Unsafety {
1101 impl_stable_hash_for!(enum hir::Constness {
1106 impl<'gcx> HashStable<StableHashingContext<'gcx>>
1107 for hir::def_id::DefIndex {
1109 fn hash_stable<W: StableHasherResult>(&self,
1110 hcx: &mut StableHashingContext<'gcx>,
1111 hasher: &mut StableHasher<W>) {
1112 hcx.local_def_path_hash(*self).hash_stable(hcx, hasher);
1116 impl<'gcx> ToStableHashKey<StableHashingContext<'gcx>>
1117 for hir::def_id::DefIndex {
1118 type KeyType = DefPathHash;
1121 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'gcx>) -> DefPathHash {
1122 hcx.local_def_path_hash(*self)
1126 impl_stable_hash_for!(struct hir::def::Export {
1132 impl<'gcx> HashStable<StableHashingContext<'gcx>>
1133 for ::middle::lang_items::LangItem {
1134 fn hash_stable<W: StableHasherResult>(&self,
1135 _: &mut StableHashingContext<'gcx>,
1136 hasher: &mut StableHasher<W>) {
1137 ::std::hash::Hash::hash(self, hasher);
1141 impl_stable_hash_for!(struct ::middle::lang_items::LanguageItems {
1146 impl<'gcx> HashStable<StableHashingContext<'gcx>>
1147 for hir::TraitCandidate {
1148 fn hash_stable<W: StableHasherResult>(&self,
1149 hcx: &mut StableHashingContext<'gcx>,
1150 hasher: &mut StableHasher<W>) {
1151 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
1152 let hir::TraitCandidate {
1157 def_id.hash_stable(hcx, hasher);
1158 import_id.hash_stable(hcx, hasher);
1163 impl_stable_hash_for!(struct hir::Freevar {