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_stable_hash_for!(enum hir::ScopeTarget {
675 impl<'a> HashStable<StableHashingContext<'a>> for ast::Ident {
676 fn hash_stable<W: StableHasherResult>(&self,
677 hcx: &mut StableHashingContext<'a>,
678 hasher: &mut StableHasher<W>) {
684 name.hash_stable(hcx, hasher);
685 span.hash_stable(hcx, hasher);
689 impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItem {
690 fn hash_stable<W: StableHasherResult>(&self,
691 hcx: &mut StableHashingContext<'a>,
692 hasher: &mut StableHasher<W>) {
703 hcx.hash_hir_item_like(|hcx| {
704 name.hash_stable(hcx, hasher);
705 attrs.hash_stable(hcx, hasher);
706 generics.hash_stable(hcx, hasher);
707 node.hash_stable(hcx, hasher);
708 span.hash_stable(hcx, hasher);
713 impl_stable_hash_for!(enum hir::TraitMethod {
718 impl_stable_hash_for!(enum hir::TraitItemKind {
724 impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
725 fn hash_stable<W: StableHasherResult>(&self,
726 hcx: &mut StableHashingContext<'a>,
727 hasher: &mut StableHasher<W>) {
740 hcx.hash_hir_item_like(|hcx| {
741 name.hash_stable(hcx, hasher);
742 vis.hash_stable(hcx, hasher);
743 defaultness.hash_stable(hcx, hasher);
744 attrs.hash_stable(hcx, hasher);
745 generics.hash_stable(hcx, hasher);
746 node.hash_stable(hcx, hasher);
747 span.hash_stable(hcx, hasher);
752 impl_stable_hash_for!(enum hir::ImplItemKind {
758 impl<'a> HashStable<StableHashingContext<'a>> for hir::Visibility {
759 fn hash_stable<W: StableHasherResult>(&self,
760 hcx: &mut StableHashingContext<'a>,
761 hasher: &mut StableHasher<W>) {
762 mem::discriminant(self).hash_stable(hcx, hasher);
764 hir::Visibility::Public |
765 hir::Visibility::Crate |
766 hir::Visibility::Inherited => {
767 // No fields to hash.
769 hir::Visibility::Restricted { ref path, id } => {
770 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
771 id.hash_stable(hcx, hasher);
773 path.hash_stable(hcx, hasher);
779 impl<'a> HashStable<StableHashingContext<'a>> for hir::Defaultness {
780 fn hash_stable<W: StableHasherResult>(&self,
781 hcx: &mut StableHashingContext<'a>,
782 hasher: &mut StableHasher<W>) {
783 mem::discriminant(self).hash_stable(hcx, hasher);
785 hir::Defaultness::Final => {
786 // No fields to hash.
788 hir::Defaultness::Default { has_value } => {
789 has_value.hash_stable(hcx, hasher);
795 impl_stable_hash_for!(enum hir::ImplPolarity {
800 impl<'a> HashStable<StableHashingContext<'a>> for hir::Mod {
801 fn hash_stable<W: StableHasherResult>(&self,
802 hcx: &mut StableHashingContext<'a>,
803 hasher: &mut StableHasher<W>) {
806 // We are not hashing the IDs of the items contained in the module.
807 // This is harmless and matches the current behavior but it's not
808 // actually correct. See issue #40876.
812 inner.hash_stable(hcx, hasher);
816 impl_stable_hash_for!(struct hir::ForeignMod {
821 impl_stable_hash_for!(struct hir::EnumDef {
825 impl_stable_hash_for!(struct hir::Variant_ {
832 impl_stable_hash_for_spanned!(hir::Variant_);
834 impl_stable_hash_for!(enum hir::UseKind {
840 impl_stable_hash_for!(struct hir::StructField {
849 impl_stable_hash_for!(enum hir::VariantData {
855 impl<'a> HashStable<StableHashingContext<'a>> for hir::Item {
856 fn hash_stable<W: StableHasherResult>(&self,
857 hcx: &mut StableHashingContext<'a>,
858 hasher: &mut StableHasher<W>) {
869 hcx.hash_hir_item_like(|hcx| {
870 name.hash_stable(hcx, hasher);
871 attrs.hash_stable(hcx, hasher);
872 node.hash_stable(hcx, hasher);
873 vis.hash_stable(hcx, hasher);
874 span.hash_stable(hcx, hasher);
879 impl_stable_hash_for!(enum hir::Item_ {
880 ItemExternCrate(orig_name),
881 ItemUse(path, use_kind),
882 ItemStatic(ty, mutability, body_id),
883 ItemConst(ty, body_id),
884 ItemFn(fn_decl, unsafety, constness, abi, generics, body_id),
886 ItemForeignMod(foreign_mod),
887 ItemGlobalAsm(global_asm),
888 ItemTy(ty, generics),
889 ItemEnum(enum_def, generics),
890 ItemStruct(variant_data, generics),
891 ItemUnion(variant_data, generics),
892 ItemTrait(is_auto, unsafety, generics, bounds, item_refs),
893 ItemTraitAlias(generics, bounds),
894 ItemImpl(unsafety, impl_polarity, impl_defaultness, generics, trait_ref, ty, impl_item_refs)
897 impl_stable_hash_for!(struct hir::TraitItemRef {
905 impl_stable_hash_for!(struct hir::ImplItemRef {
914 impl<'a> HashStable<StableHashingContext<'a>>
915 for hir::AssociatedItemKind {
916 fn hash_stable<W: StableHasherResult>(&self,
917 hcx: &mut StableHashingContext<'a>,
918 hasher: &mut StableHasher<W>) {
919 mem::discriminant(self).hash_stable(hcx, hasher);
921 hir::AssociatedItemKind::Const |
922 hir::AssociatedItemKind::Type => {
923 // No fields to hash.
925 hir::AssociatedItemKind::Method { has_self } => {
926 has_self.hash_stable(hcx, hasher);
932 impl_stable_hash_for!(struct hir::ForeignItem {
941 impl_stable_hash_for!(enum hir::ForeignItem_ {
942 ForeignItemFn(fn_decl, arg_names, generics),
943 ForeignItemStatic(ty, is_mutbl),
947 impl_stable_hash_for!(enum hir::Stmt_ {
953 impl_stable_hash_for!(struct hir::Arg {
959 impl<'a> HashStable<StableHashingContext<'a>> for hir::Body {
960 fn hash_stable<W: StableHasherResult>(&self,
961 hcx: &mut StableHashingContext<'a>,
962 hasher: &mut StableHasher<W>) {
969 hcx.with_node_id_hashing_mode(NodeIdHashingMode::Ignore, |hcx| {
970 arguments.hash_stable(hcx, hasher);
971 value.hash_stable(hcx, hasher);
972 is_generator.hash_stable(hcx, hasher);
977 impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::BodyId {
978 type KeyType = (DefPathHash, hir::ItemLocalId);
981 fn to_stable_hash_key(&self,
982 hcx: &StableHashingContext<'a>)
983 -> (DefPathHash, hir::ItemLocalId) {
984 let hir::BodyId { node_id } = *self;
985 node_id.to_stable_hash_key(hcx)
989 impl_stable_hash_for!(struct hir::InlineAsmOutput {
995 impl<'a> HashStable<StableHashingContext<'a>> for hir::GlobalAsm {
996 fn hash_stable<W: StableHasherResult>(&self,
997 hcx: &mut StableHashingContext<'a>,
998 hasher: &mut StableHasher<W>) {
1004 asm.hash_stable(hcx, hasher);
1008 impl<'a> HashStable<StableHashingContext<'a>> for hir::InlineAsm {
1009 fn hash_stable<W: StableHasherResult>(&self,
1010 hcx: &mut StableHashingContext<'a>,
1011 hasher: &mut StableHasher<W>) {
1012 let hir::InlineAsm {
1021 ctxt: _, // This is used for error reporting
1024 asm.hash_stable(hcx, hasher);
1025 asm_str_style.hash_stable(hcx, hasher);
1026 outputs.hash_stable(hcx, hasher);
1027 inputs.hash_stable(hcx, hasher);
1028 clobbers.hash_stable(hcx, hasher);
1029 volatile.hash_stable(hcx, hasher);
1030 alignstack.hash_stable(hcx, hasher);
1031 dialect.hash_stable(hcx, hasher);
1035 impl_stable_hash_for!(enum hir::def::CtorKind {
1041 impl_stable_hash_for!(enum hir::def::Def {
1050 AssociatedTy(def_id),
1053 SelfTy(trait_def_id, impl_def_id),
1057 Static(def_id, is_mutbl),
1058 StructCtor(def_id, ctor_kind),
1059 VariantCtor(def_id, ctor_kind),
1061 AssociatedConst(def_id),
1063 Upvar(def_id, index, expr_id),
1065 Macro(def_id, macro_kind),
1070 impl_stable_hash_for!(enum hir::Mutability {
1075 impl_stable_hash_for!(enum hir::IsAuto {
1080 impl_stable_hash_for!(enum hir::Unsafety {
1086 impl_stable_hash_for!(enum hir::Constness {
1091 impl<'a> HashStable<StableHashingContext<'a>>
1092 for hir::def_id::DefIndex {
1094 fn hash_stable<W: StableHasherResult>(&self,
1095 hcx: &mut StableHashingContext<'a>,
1096 hasher: &mut StableHasher<W>) {
1097 hcx.local_def_path_hash(*self).hash_stable(hcx, hasher);
1101 impl<'a> ToStableHashKey<StableHashingContext<'a>>
1102 for hir::def_id::DefIndex {
1103 type KeyType = DefPathHash;
1106 fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash {
1107 hcx.local_def_path_hash(*self)
1111 impl_stable_hash_for!(struct hir::def::Export {
1119 impl<'a> HashStable<StableHashingContext<'a>>
1120 for ::middle::lang_items::LangItem {
1121 fn hash_stable<W: StableHasherResult>(&self,
1122 _: &mut StableHashingContext<'a>,
1123 hasher: &mut StableHasher<W>) {
1124 ::std::hash::Hash::hash(self, hasher);
1128 impl_stable_hash_for!(struct ::middle::lang_items::LanguageItems {
1133 impl<'a> HashStable<StableHashingContext<'a>>
1134 for hir::TraitCandidate {
1135 fn hash_stable<W: StableHasherResult>(&self,
1136 hcx: &mut StableHashingContext<'a>,
1137 hasher: &mut StableHasher<W>) {
1138 hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
1139 let hir::TraitCandidate {
1144 def_id.hash_stable(hcx, hasher);
1145 import_id.hash_stable(hcx, hasher);
1150 impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate {
1151 type KeyType = (DefPathHash, Option<(DefPathHash, hir::ItemLocalId)>);
1153 fn to_stable_hash_key(&self,
1154 hcx: &StableHashingContext<'a>)
1156 let hir::TraitCandidate {
1161 let import_id = import_id.map(|node_id| hcx.node_to_hir_id(node_id))
1162 .map(|hir_id| (hcx.local_def_path_hash(hir_id.owner),
1164 (hcx.def_path_hash(def_id), import_id)
1168 impl<'hir> HashStable<StableHashingContext<'hir>> for hir::TransFnAttrs
1170 fn hash_stable<W: StableHasherResult>(&self,
1171 hcx: &mut StableHashingContext<'hir>,
1172 hasher: &mut StableHasher<W>) {
1173 let hir::TransFnAttrs {
1177 ref target_features,
1181 flags.hash_stable(hcx, hasher);
1182 inline.hash_stable(hcx, hasher);
1183 export_name.hash_stable(hcx, hasher);
1184 target_features.hash_stable(hcx, hasher);
1185 linkage.hash_stable(hcx, hasher);
1189 impl<'hir> HashStable<StableHashingContext<'hir>> for hir::TransFnAttrFlags
1191 fn hash_stable<W: StableHasherResult>(&self,
1192 hcx: &mut StableHashingContext<'hir>,
1193 hasher: &mut StableHasher<W>) {
1194 self.bits().hash_stable(hcx, hasher);
1198 impl<'hir> HashStable<StableHashingContext<'hir>> for attr::InlineAttr {
1199 fn hash_stable<W: StableHasherResult>(&self,
1200 hcx: &mut StableHashingContext<'hir>,
1201 hasher: &mut StableHasher<W>) {
1202 mem::discriminant(self).hash_stable(hcx, hasher);
1206 impl_stable_hash_for!(struct hir::Freevar {