@@ -8,7 +8,8 @@ use rustc_data_structures::stable_hasher::{
88} ;
99use rustc_error_messages:: { DiagMessage , MultiSpan } ;
1010use rustc_hir:: def:: Namespace ;
11- use rustc_hir:: { HashStableContext , HirId , MissingLifetimeKind } ;
11+ use rustc_hir:: def_id:: DefPathHash ;
12+ use rustc_hir:: { HashStableContext , HirId , ItemLocalId , MissingLifetimeKind } ;
1213use rustc_macros:: { Decodable , Encodable , HashStable_Generic } ;
1314pub use rustc_span:: edition:: Edition ;
1415use rustc_span:: { Ident , MacroRulesNormalizedIdent , Span , Symbol , sym} ;
@@ -102,7 +103,7 @@ pub enum Applicability {
102103/// The index values have a type of `u16` to reduce the size of the `LintExpectationId`.
103104/// It's reasonable to assume that no user will define 2^16 attributes on one node or
104105/// have that amount of lints listed. `u16` values should therefore suffice.
105- #[ derive( Clone , Copy , PartialEq , PartialOrd , Eq , Ord , Debug , Hash , Encodable , Decodable ) ]
106+ #[ derive( Clone , Copy , PartialEq , Eq , Debug , Hash , Encodable , Decodable ) ]
106107pub enum LintExpectationId {
107108 /// Used for lints emitted during the `EarlyLintPass`. This id is not
108109 /// hash stable and should not be cached.
@@ -156,13 +157,14 @@ impl<HCX: rustc_hir::HashStableContext> HashStable<HCX> for LintExpectationId {
156157}
157158
158159impl < HCX : rustc_hir:: HashStableContext > ToStableHashKey < HCX > for LintExpectationId {
159- type KeyType = ( HirId , u16 , u16 ) ;
160+ type KeyType = ( DefPathHash , ItemLocalId , u16 , u16 ) ;
160161
161162 #[ inline]
162- fn to_stable_hash_key ( & self , _ : & HCX ) -> Self :: KeyType {
163+ fn to_stable_hash_key ( & self , hcx : & HCX ) -> Self :: KeyType {
163164 match self {
164165 LintExpectationId :: Stable { hir_id, attr_index, lint_index : Some ( lint_index) } => {
165- ( * hir_id, * attr_index, * lint_index)
166+ let ( def_path_hash, lint_idx) = hir_id. to_stable_hash_key ( hcx) ;
167+ ( def_path_hash, lint_idx, * attr_index, * lint_index)
166168 }
167169 _ => {
168170 unreachable ! ( "HashStable should only be called for a filled `LintExpectationId`" )
0 commit comments