@@ -713,7 +713,15 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItem {
713
713
span
714
714
} = * self ;
715
715
716
- hcx. hash_hir_item_like ( attrs, |hcx| {
716
+ let is_const = match * node {
717
+ hir:: TraitItemKind :: Const ( ..) |
718
+ hir:: TraitItemKind :: Type ( ..) => true ,
719
+ hir:: TraitItemKind :: Method ( hir:: MethodSig { constness, .. } , _) => {
720
+ constness == hir:: Constness :: Const
721
+ }
722
+ } ;
723
+
724
+ hcx. hash_hir_item_like ( attrs, is_const, |hcx| {
717
725
name. hash_stable ( hcx, hasher) ;
718
726
attrs. hash_stable ( hcx, hasher) ;
719
727
generics. hash_stable ( hcx, hasher) ;
@@ -750,7 +758,15 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItem {
750
758
span
751
759
} = * self ;
752
760
753
- hcx. hash_hir_item_like ( attrs, |hcx| {
761
+ let is_const = match * node {
762
+ hir:: ImplItemKind :: Const ( ..) |
763
+ hir:: ImplItemKind :: Type ( ..) => true ,
764
+ hir:: ImplItemKind :: Method ( hir:: MethodSig { constness, .. } , _) => {
765
+ constness == hir:: Constness :: Const
766
+ }
767
+ } ;
768
+
769
+ hcx. hash_hir_item_like ( attrs, is_const, |hcx| {
754
770
name. hash_stable ( hcx, hasher) ;
755
771
vis. hash_stable ( hcx, hasher) ;
756
772
defaultness. hash_stable ( hcx, hasher) ;
@@ -869,11 +885,13 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
869
885
fn hash_stable < W : StableHasherResult > ( & self ,
870
886
hcx : & mut StableHashingContext < ' gcx > ,
871
887
hasher : & mut StableHasher < W > ) {
872
- let hash_spans = match self . node {
888
+ let ( is_const , hash_spans) = match self . node {
873
889
hir:: ItemStatic ( ..) |
874
- hir:: ItemConst ( ..) |
875
- hir:: ItemFn ( ..) => {
876
- hcx. hash_spans ( )
890
+ hir:: ItemConst ( ..) => {
891
+ ( true , hcx. hash_spans ( ) )
892
+ }
893
+ hir:: ItemFn ( _, _, constness, ..) => {
894
+ ( constness == hir:: Constness :: Const , hcx. hash_spans ( ) )
877
895
}
878
896
hir:: ItemUse ( ..) |
879
897
hir:: ItemExternCrate ( ..) |
@@ -887,7 +905,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
887
905
hir:: ItemEnum ( ..) |
888
906
hir:: ItemStruct ( ..) |
889
907
hir:: ItemUnion ( ..) => {
890
- false
908
+ ( false , false )
891
909
}
892
910
} ;
893
911
@@ -901,7 +919,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
901
919
span
902
920
} = * self ;
903
921
904
- hcx. hash_hir_item_like ( attrs, |hcx| {
922
+ hcx. hash_hir_item_like ( attrs, is_const , |hcx| {
905
923
hcx. while_hashing_spans ( hash_spans, |hcx| {
906
924
name. hash_stable ( hcx, hasher) ;
907
925
attrs. hash_stable ( hcx, hasher) ;
0 commit comments