@@ -713,7 +713,15 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::TraitItem {
713713 span
714714 } = * self ;
715715
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| {
717725 name. hash_stable ( hcx, hasher) ;
718726 attrs. hash_stable ( hcx, hasher) ;
719727 generics. hash_stable ( hcx, hasher) ;
@@ -750,7 +758,15 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::ImplItem {
750758 span
751759 } = * self ;
752760
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| {
754770 name. hash_stable ( hcx, hasher) ;
755771 vis. hash_stable ( hcx, hasher) ;
756772 defaultness. hash_stable ( hcx, hasher) ;
@@ -869,11 +885,13 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
869885 fn hash_stable < W : StableHasherResult > ( & self ,
870886 hcx : & mut StableHashingContext < ' gcx > ,
871887 hasher : & mut StableHasher < W > ) {
872- let hash_spans = match self . node {
888+ let ( is_const , hash_spans) = match self . node {
873889 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 ( ) )
877895 }
878896 hir:: ItemUse ( ..) |
879897 hir:: ItemExternCrate ( ..) |
@@ -887,7 +905,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
887905 hir:: ItemEnum ( ..) |
888906 hir:: ItemStruct ( ..) |
889907 hir:: ItemUnion ( ..) => {
890- false
908+ ( false , false )
891909 }
892910 } ;
893911
@@ -901,7 +919,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
901919 span
902920 } = * self ;
903921
904- hcx. hash_hir_item_like ( attrs, |hcx| {
922+ hcx. hash_hir_item_like ( attrs, is_const , |hcx| {
905923 hcx. while_hashing_spans ( hash_spans, |hcx| {
906924 name. hash_stable ( hcx, hasher) ;
907925 attrs. hash_stable ( hcx, hasher) ;
0 commit comments