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, LocalDefId, CrateNum, CRATE_DEF_INDEX};
17 use ich::{StableHashingContext, NodeIdHashingMode};
18 use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
19 StableHasher, StableHasherResult};
24 impl<'a> HashStable<StableHashingContext<'a>> for DefId {
26 fn hash_stable<W: StableHasherResult>(&self,
27 hcx: &mut StableHashingContext<'a>,
28 hasher: &mut StableHasher<W>) {
29 hcx.def_path_hash(*self).hash_stable(hcx, hasher);
33 impl<'a> ToStableHashKey<StableHashingContext<'a>> for DefId {
34 type KeyType = DefPathHash;
37 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash {
38 hcx.def_path_hash(*self)
42 impl<'a> HashStable<StableHashingContext<'a>> for LocalDefId {
44 fn hash_stable<W: StableHasherResult>(&self,
45 hcx: &mut StableHashingContext<'a>,
46 hasher: &mut StableHasher<W>) {
47 hcx.def_path_hash(self.to_def_id()).hash_stable(hcx, hasher);
51 impl<'a> ToStableHashKey<StableHashingContext<'a>> for LocalDefId {
52 type KeyType = DefPathHash;
55 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash {
56 hcx.def_path_hash(self.to_def_id())
60 impl<'a> HashStable<StableHashingContext<'a>> for CrateNum {
62 fn hash_stable<W: StableHasherResult>(&self,
63 hcx: &mut StableHashingContext<'a>,
64 hasher: &mut StableHasher<W>) {
65 hcx.def_path_hash(DefId {
67 index: CRATE_DEF_INDEX
68 }).hash_stable(hcx, hasher);
72 impl<'a> ToStableHashKey<StableHashingContext<'a>> for CrateNum {
73 type KeyType = DefPathHash;
76 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash {
77 let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX };
78 def_id.to_stable_hash_key(hcx)
82 impl_stable_hash_for!(tuple_struct hir::ItemLocalId { index });
84 impl<'a> ToStableHashKey<StableHashingContext<'a>>
85 for hir::ItemLocalId {
86 type KeyType = hir::ItemLocalId;
89 fn to_stable_hash_key(&self,
90 _: &StableHashingContext<'a>)
96 // The following implementations of HashStable for ItemId, TraitItemId, and
97 // ImplItemId deserve special attention. Normally we do not hash NodeIds within
98 // the HIR, since they just signify a HIR nodes own path. But ItemId et al
99 // are used when another item in the HIR is *referenced* and we certainly
100 // want to pick up on a reference changing its target, so we hash the NodeIds
101 // in "DefPath Mode".
103 impl<'a> HashStable<StableHashingContext<'a>> for hir::ItemId {
104 fn hash_stable<W: StableHasherResult>(&self,
105 hcx: &mut StableHashingContext<'a>,
106 hasher: &mut StableHasher<W>) {
111 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
112 id.hash_stable(hcx, hasher);
117 impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItemId {
118 fn hash_stable<W: StableHasherResult>(&self,
119 hcx: &mut StableHashingContext<'a>,
120 hasher: &mut StableHasher<W>) {
121 let hir::TraitItemId {
125 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
126 node_id.hash_stable(hcx, hasher);
131 impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItemId {
132 fn hash_stable<W: StableHasherResult>(&self,
133 hcx: &mut StableHashingContext<'a>,
134 hasher: &mut StableHasher<W>) {
135 let hir::ImplItemId {
139 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
140 node_id.hash_stable(hcx, hasher);
145 impl_stable_hash_for!(enum hir::LifetimeName {
153 impl_stable_hash_for!(struct hir::Label {
158 impl_stable_hash_for!(struct hir::Lifetime {
164 impl_stable_hash_for!(struct hir::LifetimeDef {
171 impl_stable_hash_for!(struct hir::Path {
177 impl_stable_hash_for!(struct hir::PathSegment {
183 impl_stable_hash_for!(struct hir::PathParameters {
190 impl_stable_hash_for!(enum hir::TyParamBound {
191 TraitTyParamBound(poly_trait_ref, trait_bound_modifier),
192 RegionTyParamBound(lifetime)
195 impl_stable_hash_for!(enum hir::TraitBoundModifier {
200 impl_stable_hash_for!(struct hir::TyParam {
211 impl_stable_hash_for!(enum hir::GenericParam {
212 Lifetime(lifetime_def),
216 impl_stable_hash_for!(struct hir::Generics {
222 impl_stable_hash_for!(enum hir::SyntheticTyParamKind {
226 impl_stable_hash_for!(struct hir::WhereClause {
231 impl_stable_hash_for!(enum hir::WherePredicate {
232 BoundPredicate(pred),
233 RegionPredicate(pred),
237 impl_stable_hash_for!(struct hir::WhereBoundPredicate {
239 bound_generic_params,
244 impl_stable_hash_for!(struct hir::WhereRegionPredicate {
250 impl_stable_hash_for!(struct hir::WhereEqPredicate {
257 impl_stable_hash_for!(struct hir::MutTy {
262 impl_stable_hash_for!(struct hir::MethodSig {
269 impl_stable_hash_for!(struct hir::TypeBinding {
276 impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
277 fn hash_stable<W: StableHasherResult>(&self,
278 hcx: &mut StableHashingContext<'a>,
279 hasher: &mut StableHasher<W>) {
280 hcx.while_hashing_hir_bodies(true, |hcx| {
288 node.hash_stable(hcx, hasher);
289 span.hash_stable(hcx, hasher);
294 impl_stable_hash_for!(enum hir::PrimTy {
303 impl_stable_hash_for!(struct hir::BareFnTy {
311 impl_stable_hash_for!(struct hir::ExistTy {
316 impl_stable_hash_for!(enum hir::Ty_ {
325 TyTraitObject(trait_refs, lifetime),
326 TyImplTraitExistential(existty, lifetimes),
332 impl_stable_hash_for!(struct hir::FnDecl {
339 impl_stable_hash_for!(enum hir::FunctionRetTy {
344 impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitRef {
345 fn hash_stable<W: StableHasherResult>(&self,
346 hcx: &mut StableHashingContext<'a>,
347 hasher: &mut StableHasher<W>) {
350 // Don't hash the ref_id. It is tracked via the thing it is used to access
354 path.hash_stable(hcx, hasher);
359 impl_stable_hash_for!(struct hir::PolyTraitRef {
360 bound_generic_params,
365 impl_stable_hash_for!(enum hir::QPath {
367 TypeRelative(t, path_segment)
370 impl_stable_hash_for!(struct hir::MacroDef {
381 impl<'a> HashStable<StableHashingContext<'a>> for hir::Block {
382 fn hash_stable<W: StableHasherResult>(&self,
383 hcx: &mut StableHashingContext<'a>,
384 hasher: &mut StableHasher<W>) {
396 stmts.hash_stable(hcx, hasher);
397 expr.hash_stable(hcx, hasher);
398 rules.hash_stable(hcx, hasher);
399 span.hash_stable(hcx, hasher);
400 recovered.hash_stable(hcx, hasher);
401 targeted_by_break.hash_stable(hcx, hasher);
405 impl<'a> HashStable<StableHashingContext<'a>> for hir::Pat {
406 fn hash_stable<W: StableHasherResult>(&self,
407 hcx: &mut StableHashingContext<'a>,
408 hasher: &mut StableHasher<W>) {
417 node.hash_stable(hcx, hasher);
418 span.hash_stable(hcx, hasher);
422 impl_stable_hash_for_spanned!(hir::FieldPat);
424 impl<'a> HashStable<StableHashingContext<'a>> for hir::FieldPat {
425 fn hash_stable<W: StableHasherResult>(&self,
426 hcx: &mut StableHashingContext<'a>,
427 hasher: &mut StableHasher<W>) {
435 name.hash_stable(hcx, hasher);
436 pat.hash_stable(hcx, hasher);
437 is_shorthand.hash_stable(hcx, hasher);
441 impl_stable_hash_for!(enum hir::BindingAnnotation {
448 impl_stable_hash_for!(enum hir::RangeEnd {
453 impl_stable_hash_for!(enum hir::PatKind {
455 Binding(binding_mode, var, name, sub),
456 Struct(path, field_pats, dotdot),
457 TupleStruct(path, field_pats, dotdot),
459 Tuple(field_pats, dotdot),
461 Ref(sub, mutability),
463 Range(start, end, end_kind),
464 Slice(one, two, three)
467 impl_stable_hash_for!(enum hir::BinOp_ {
488 impl_stable_hash_for_spanned!(hir::BinOp_);
490 impl_stable_hash_for!(enum hir::UnOp {
496 impl_stable_hash_for_spanned!(hir::Stmt_);
498 impl_stable_hash_for!(struct hir::Local {
509 impl_stable_hash_for_spanned!(hir::Decl_);
510 impl_stable_hash_for!(enum hir::Decl_ {
515 impl_stable_hash_for!(struct hir::Arm {
522 impl<'a> HashStable<StableHashingContext<'a>> for hir::Field {
523 fn hash_stable<W: StableHasherResult>(&self,
524 hcx: &mut StableHashingContext<'a>,
525 hasher: &mut StableHasher<W>) {
534 name.hash_stable(hcx, hasher);
535 expr.hash_stable(hcx, hasher);
536 span.hash_stable(hcx, hasher);
537 is_shorthand.hash_stable(hcx, hasher);
541 impl_stable_hash_for_spanned!(ast::Name);
544 impl_stable_hash_for!(enum hir::BlockCheckMode {
547 PushUnsafeBlock(src),
551 impl_stable_hash_for!(enum hir::UnsafeSource {
556 impl<'a> HashStable<StableHashingContext<'a>> for hir::Expr {
557 fn hash_stable<W: StableHasherResult>(&self,
558 hcx: &mut StableHashingContext<'a>,
559 hasher: &mut StableHasher<W>) {
560 hcx.while_hashing_hir_bodies(true, |hcx| {
569 span.hash_stable(hcx, hasher);
570 node.hash_stable(hcx, hasher);
571 attrs.hash_stable(hcx, hasher);
576 impl_stable_hash_for!(enum hir::Expr_ {
579 ExprCall(callee, args),
580 ExprMethodCall(segment, span, args),
582 ExprBinary(op, lhs, rhs),
583 ExprUnary(op, operand),
587 ExprIf(cond, then, els),
588 ExprWhile(cond, body, label),
589 ExprLoop(body, label, loop_src),
590 ExprMatch(matchee, arms, match_src),
591 ExprClosure(capture_clause, decl, body_id, span, gen),
593 ExprAssign(lhs, rhs),
594 ExprAssignOp(op, lhs, rhs),
595 ExprField(owner, field_name),
598 ExprAddrOf(mutability, sub),
599 ExprBreak(destination, sub),
600 ExprAgain(destination),
602 ExprInlineAsm(asm, inputs, outputs),
603 ExprStruct(path, fields, base),
604 ExprRepeat(val, times),
608 impl_stable_hash_for!(enum hir::LocalSource {
613 impl_stable_hash_for!(enum hir::LoopSource {
619 impl<'a> HashStable<StableHashingContext<'a>> for hir::MatchSource {
620 fn hash_stable<W: StableHasherResult>(&self,
621 hcx: &mut StableHashingContext<'a>,
622 hasher: &mut StableHasher<W>) {
623 use hir::MatchSource;
625 mem::discriminant(self).hash_stable(hcx, hasher);
627 MatchSource::Normal |
628 MatchSource::WhileLetDesugar |
629 MatchSource::ForLoopDesugar |
630 MatchSource::TryDesugar => {
631 // No fields to hash.
633 MatchSource::IfLetDesugar { contains_else_clause } => {
634 contains_else_clause.hash_stable(hcx, hasher);
640 impl_stable_hash_for!(enum hir::GeneratorMovability {
645 impl_stable_hash_for!(enum hir::CaptureClause {
650 impl_stable_hash_for_spanned!(usize);
652 impl_stable_hash_for!(struct hir::Destination {
657 impl_stable_hash_for_spanned!(ast::Ident);
659 impl_stable_hash_for!(enum hir::LoopIdResult {
664 impl_stable_hash_for!(enum hir::LoopIdError {
666 UnlabeledCfInWhileCondition,
670 impl<'a> HashStable<StableHashingContext<'a>> for ast::Ident {
671 fn hash_stable<W: StableHasherResult>(&self,
672 hcx: &mut StableHashingContext<'a>,
673 hasher: &mut StableHasher<W>) {
679 name.hash_stable(hcx, hasher);
680 span.hash_stable(hcx, hasher);
684 impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItem {
685 fn hash_stable<W: StableHasherResult>(&self,
686 hcx: &mut StableHashingContext<'a>,
687 hasher: &mut StableHasher<W>) {
698 hcx.hash_hir_item_like(|hcx| {
699 name.hash_stable(hcx, hasher);
700 attrs.hash_stable(hcx, hasher);
701 generics.hash_stable(hcx, hasher);
702 node.hash_stable(hcx, hasher);
703 span.hash_stable(hcx, hasher);
708 impl_stable_hash_for!(enum hir::TraitMethod {
713 impl_stable_hash_for!(enum hir::TraitItemKind {
719 impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
720 fn hash_stable<W: StableHasherResult>(&self,
721 hcx: &mut StableHashingContext<'a>,
722 hasher: &mut StableHasher<W>) {
735 hcx.hash_hir_item_like(|hcx| {
736 name.hash_stable(hcx, hasher);
737 vis.hash_stable(hcx, hasher);
738 defaultness.hash_stable(hcx, hasher);
739 attrs.hash_stable(hcx, hasher);
740 generics.hash_stable(hcx, hasher);
741 node.hash_stable(hcx, hasher);
742 span.hash_stable(hcx, hasher);
747 impl_stable_hash_for!(enum hir::ImplItemKind {
753 impl<'a> HashStable<StableHashingContext<'a>> for hir::Visibility {
754 fn hash_stable<W: StableHasherResult>(&self,
755 hcx: &mut StableHashingContext<'a>,
756 hasher: &mut StableHasher<W>) {
757 mem::discriminant(self).hash_stable(hcx, hasher);
759 hir::Visibility::Public |
760 hir::Visibility::Crate |
761 hir::Visibility::Inherited => {
762 // No fields to hash.
764 hir::Visibility::Restricted { ref path, id } => {
765 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
766 id.hash_stable(hcx, hasher);
768 path.hash_stable(hcx, hasher);
774 impl<'a> HashStable<StableHashingContext<'a>> for hir::Defaultness {
775 fn hash_stable<W: StableHasherResult>(&self,
776 hcx: &mut StableHashingContext<'a>,
777 hasher: &mut StableHasher<W>) {
778 mem::discriminant(self).hash_stable(hcx, hasher);
780 hir::Defaultness::Final => {
781 // No fields to hash.
783 hir::Defaultness::Default { has_value } => {
784 has_value.hash_stable(hcx, hasher);
790 impl_stable_hash_for!(enum hir::ImplPolarity {
795 impl<'a> HashStable<StableHashingContext<'a>> for hir::Mod {
796 fn hash_stable<W: StableHasherResult>(&self,
797 hcx: &mut StableHashingContext<'a>,
798 hasher: &mut StableHasher<W>) {
801 // We are not hashing the IDs of the items contained in the module.
802 // This is harmless and matches the current behavior but it's not
803 // actually correct. See issue #40876.
807 inner.hash_stable(hcx, hasher);
811 impl_stable_hash_for!(struct hir::ForeignMod {
816 impl_stable_hash_for!(struct hir::EnumDef {
820 impl_stable_hash_for!(struct hir::Variant_ {
827 impl_stable_hash_for_spanned!(hir::Variant_);
829 impl_stable_hash_for!(enum hir::UseKind {
835 impl_stable_hash_for!(struct hir::StructField {
844 impl_stable_hash_for!(enum hir::VariantData {
850 impl<'a> HashStable<StableHashingContext<'a>> for hir::Item {
851 fn hash_stable<W: StableHasherResult>(&self,
852 hcx: &mut StableHashingContext<'a>,
853 hasher: &mut StableHasher<W>) {
864 hcx.hash_hir_item_like(|hcx| {
865 name.hash_stable(hcx, hasher);
866 attrs.hash_stable(hcx, hasher);
867 node.hash_stable(hcx, hasher);
868 vis.hash_stable(hcx, hasher);
869 span.hash_stable(hcx, hasher);
874 impl_stable_hash_for!(enum hir::Item_ {
875 ItemExternCrate(orig_name),
876 ItemUse(path, use_kind),
877 ItemStatic(ty, mutability, body_id),
878 ItemConst(ty, body_id),
879 ItemFn(fn_decl, unsafety, constness, abi, generics, body_id),
881 ItemForeignMod(foreign_mod),
882 ItemGlobalAsm(global_asm),
883 ItemTy(ty, generics),
884 ItemEnum(enum_def, generics),
885 ItemStruct(variant_data, generics),
886 ItemUnion(variant_data, generics),
887 ItemTrait(is_auto, unsafety, generics, bounds, item_refs),
888 ItemTraitAlias(generics, bounds),
889 ItemImpl(unsafety, impl_polarity, impl_defaultness, generics, trait_ref, ty, impl_item_refs)
892 impl_stable_hash_for!(struct hir::TraitItemRef {
900 impl_stable_hash_for!(struct hir::ImplItemRef {
909 impl<'a> HashStable<StableHashingContext<'a>>
910 for hir::AssociatedItemKind {
911 fn hash_stable<W: StableHasherResult>(&self,
912 hcx: &mut StableHashingContext<'a>,
913 hasher: &mut StableHasher<W>) {
914 mem::discriminant(self).hash_stable(hcx, hasher);
916 hir::AssociatedItemKind::Const |
917 hir::AssociatedItemKind::Type => {
918 // No fields to hash.
920 hir::AssociatedItemKind::Method { has_self } => {
921 has_self.hash_stable(hcx, hasher);
927 impl_stable_hash_for!(struct hir::ForeignItem {
936 impl_stable_hash_for!(enum hir::ForeignItem_ {
937 ForeignItemFn(fn_decl, arg_names, generics),
938 ForeignItemStatic(ty, is_mutbl),
942 impl_stable_hash_for!(enum hir::Stmt_ {
948 impl_stable_hash_for!(struct hir::Arg {
954 impl<'a> HashStable<StableHashingContext<'a>> for hir::Body {
955 fn hash_stable<W: StableHasherResult>(&self,
956 hcx: &mut StableHashingContext<'a>,
957 hasher: &mut StableHasher<W>) {
964 hcx.with_node_id_hashing_mode(NodeIdHashingMode::Ignore, |hcx| {
965 arguments.hash_stable(hcx, hasher);
966 value.hash_stable(hcx, hasher);
967 is_generator.hash_stable(hcx, hasher);
972 impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::BodyId {
973 type KeyType = (DefPathHash, hir::ItemLocalId);
976 fn to_stable_hash_key(&self,
977 hcx: &StableHashingContext<'a>)
978 -> (DefPathHash, hir::ItemLocalId) {
979 let hir::BodyId { node_id } = *self;
980 node_id.to_stable_hash_key(hcx)
984 impl_stable_hash_for!(struct hir::InlineAsmOutput {
990 impl<'a> HashStable<StableHashingContext<'a>> for hir::GlobalAsm {
991 fn hash_stable<W: StableHasherResult>(&self,
992 hcx: &mut StableHashingContext<'a>,
993 hasher: &mut StableHasher<W>) {
999 asm.hash_stable(hcx, hasher);
1003 impl<'a> HashStable<StableHashingContext<'a>> for hir::InlineAsm {
1004 fn hash_stable<W: StableHasherResult>(&self,
1005 hcx: &mut StableHashingContext<'a>,
1006 hasher: &mut StableHasher<W>) {
1007 let hir::InlineAsm {
1016 ctxt: _, // This is used for error reporting
1019 asm.hash_stable(hcx, hasher);
1020 asm_str_style.hash_stable(hcx, hasher);
1021 outputs.hash_stable(hcx, hasher);
1022 inputs.hash_stable(hcx, hasher);
1023 clobbers.hash_stable(hcx, hasher);
1024 volatile.hash_stable(hcx, hasher);
1025 alignstack.hash_stable(hcx, hasher);
1026 dialect.hash_stable(hcx, hasher);
1030 impl_stable_hash_for!(enum hir::def::CtorKind {
1036 impl_stable_hash_for!(enum hir::def::Def {
1045 AssociatedTy(def_id),
1048 SelfTy(trait_def_id, impl_def_id),
1052 Static(def_id, is_mutbl),
1053 StructCtor(def_id, ctor_kind),
1054 VariantCtor(def_id, ctor_kind),
1056 AssociatedConst(def_id),
1058 Upvar(def_id, index, expr_id),
1060 Macro(def_id, macro_kind),
1065 impl_stable_hash_for!(enum hir::Mutability {
1070 impl_stable_hash_for!(enum hir::IsAuto {
1075 impl_stable_hash_for!(enum hir::Unsafety {
1081 impl_stable_hash_for!(enum hir::Constness {
1086 impl<'a> HashStable<StableHashingContext<'a>>
1087 for hir::def_id::DefIndex {
1089 fn hash_stable<W: StableHasherResult>(&self,
1090 hcx: &mut StableHashingContext<'a>,
1091 hasher: &mut StableHasher<W>) {
1092 hcx.local_def_path_hash(*self).hash_stable(hcx, hasher);
1096 impl<'a> ToStableHashKey<StableHashingContext<'a>>
1097 for hir::def_id::DefIndex {
1098 type KeyType = DefPathHash;
1101 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash {
1102 hcx.local_def_path_hash(*self)
1106 impl_stable_hash_for!(struct hir::def::Export {
1114 impl<'a> HashStable<StableHashingContext<'a>>
1115 for ::middle::lang_items::LangItem {
1116 fn hash_stable<W: StableHasherResult>(&self,
1117 _: &mut StableHashingContext<'a>,
1118 hasher: &mut StableHasher<W>) {
1119 ::std::hash::Hash::hash(self, hasher);
1123 impl_stable_hash_for!(struct ::middle::lang_items::LanguageItems {
1128 impl<'a> HashStable<StableHashingContext<'a>>
1129 for hir::TraitCandidate {
1130 fn hash_stable<W: StableHasherResult>(&self,
1131 hcx: &mut StableHashingContext<'a>,
1132 hasher: &mut StableHasher<W>) {
1133 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
1134 let hir::TraitCandidate {
1139 def_id.hash_stable(hcx, hasher);
1140 import_id.hash_stable(hcx, hasher);
1145 impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate {
1146 type KeyType = (DefPathHash, Option<(DefPathHash, hir::ItemLocalId)>);
1148 fn to_stable_hash_key(&self,
1149 hcx: &StableHashingContext<'a>)
1151 let hir::TraitCandidate {
1156 let import_id = import_id.map(|node_id| hcx.node_to_hir_id(node_id))
1157 .map(|hir_id| (hcx.local_def_path_hash(hir_id.owner),
1159 (hcx.def_path_hash(def_id), import_id)
1163 impl<'hir> HashStable<StableHashingContext<'hir>> for hir::TransFnAttrs
1165 fn hash_stable<W: StableHasherResult>(&self,
1166 hcx: &mut StableHashingContext<'hir>,
1167 hasher: &mut StableHasher<W>) {
1168 let hir::TransFnAttrs {
1172 ref target_features,
1176 flags.hash_stable(hcx, hasher);
1177 inline.hash_stable(hcx, hasher);
1178 export_name.hash_stable(hcx, hasher);
1179 target_features.hash_stable(hcx, hasher);
1180 linkage.hash_stable(hcx, hasher);
1184 impl<'hir> HashStable<StableHashingContext<'hir>> for hir::TransFnAttrFlags
1186 fn hash_stable<W: StableHasherResult>(&self,
1187 hcx: &mut StableHashingContext<'hir>,
1188 hasher: &mut StableHasher<W>) {
1189 self.bits().hash_stable(hcx, hasher);
1193 impl<'hir> HashStable<StableHashingContext<'hir>> for attr::InlineAttr {
1194 fn hash_stable<W: StableHasherResult>(&self,
1195 hcx: &mut StableHashingContext<'hir>,
1196 hasher: &mut StableHasher<W>) {
1197 mem::discriminant(self).hash_stable(hcx, hasher);
1201 impl_stable_hash_for!(struct hir::Freevar {