@@ -10,7 +10,7 @@ use rustc_hir::{
1010 AssocItemConstraint , BinOpKind , BindingMode , Block , BodyId , Closure , ConstArg , ConstArgKind , Expr , ExprField ,
1111 ExprKind , FnRetTy , GenericArg , GenericArgs , HirId , HirIdMap , InlineAsmOperand , LetExpr , Lifetime , LifetimeName ,
1212 Pat , PatExpr , PatExprKind , PatField , PatKind , Path , PathSegment , PrimTy , QPath , Stmt , StmtKind , StructTailExpr ,
13- TraitBoundModifiers , Ty , TyKind ,
13+ TraitBoundModifiers , Ty , TyKind , TyPat , TyPatKind ,
1414} ;
1515use rustc_lexer:: { TokenKind , tokenize} ;
1616use rustc_lint:: LateContext ;
@@ -1102,6 +1102,22 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
11021102 }
11031103 }
11041104
1105+ pub fn hash_ty_pat ( & mut self , pat : & TyPat < ' _ > ) {
1106+ std:: mem:: discriminant ( & pat. kind ) . hash ( & mut self . s ) ;
1107+ match pat. kind {
1108+ TyPatKind :: Range ( s, e, i) => {
1109+ if let Some ( s) = s {
1110+ self . hash_const_arg ( s) ;
1111+ }
1112+ if let Some ( e) = e {
1113+ self . hash_const_arg ( e) ;
1114+ }
1115+ std:: mem:: discriminant ( & i) . hash ( & mut self . s ) ;
1116+ } ,
1117+ TyPatKind :: Err ( _) => { } ,
1118+ }
1119+ }
1120+
11051121 pub fn hash_pat ( & mut self , pat : & Pat < ' _ > ) {
11061122 std:: mem:: discriminant ( & pat. kind ) . hash ( & mut self . s ) ;
11071123 match pat. kind {
@@ -1247,7 +1263,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12471263 } ,
12481264 TyKind :: Pat ( ty, pat) => {
12491265 self . hash_ty ( ty) ;
1250- self . hash_pat ( pat) ;
1266+ self . hash_ty_pat ( pat) ;
12511267 } ,
12521268 TyKind :: Ptr ( mut_ty) => {
12531269 self . hash_ty ( mut_ty. ty ) ;
0 commit comments