@@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHasher;
77use rustc_hir:: MatchSource :: TryDesugar ;
88use rustc_hir:: def:: { DefKind , Res } ;
99use rustc_hir:: {
10- ArrayLen , AssocItemConstraint , BinOpKind , BindingMode , Block , BodyId , Closure , ConstArg , ConstArgKind , Expr ,
10+ AssocItemConstraint , BinOpKind , BindingMode , Block , BodyId , Closure , ConstArg , ConstArgKind , Expr ,
1111 ExprField , ExprKind , FnRetTy , GenericArg , GenericArgs , HirId , HirIdMap , InlineAsmOperand , LetExpr , Lifetime ,
1212 LifetimeName , Pat , PatField , PatKind , Path , PathSegment , PrimTy , QPath , Stmt , StmtKind , TraitBoundModifiers , Ty ,
1313 TyKind ,
@@ -266,14 +266,6 @@ impl HirEqInterExpr<'_, '_, '_> {
266266 } )
267267 }
268268
269- pub fn eq_array_length ( & mut self , left : ArrayLen < ' _ > , right : ArrayLen < ' _ > ) -> bool {
270- match ( left, right) {
271- ( ArrayLen :: Infer ( ..) , ArrayLen :: Infer ( ..) ) => true ,
272- ( ArrayLen :: Body ( l_ct) , ArrayLen :: Body ( r_ct) ) => self . eq_const_arg ( l_ct, r_ct) ,
273- ( _, _) => false ,
274- }
275- }
276-
277269 pub fn eq_body ( & mut self , left : BodyId , right : BodyId ) -> bool {
278270 // swap out TypeckResults when hashing a body
279271 let old_maybe_typeck_results = self . inner . maybe_typeck_results . replace ( (
@@ -383,7 +375,7 @@ impl HirEqInterExpr<'_, '_, '_> {
383375 } ,
384376 ( ExprKind :: Path ( l) , ExprKind :: Path ( r) ) => self . eq_qpath ( l, r) ,
385377 ( & ExprKind :: Repeat ( le, ll) , & ExprKind :: Repeat ( re, rl) ) => {
386- self . eq_expr ( le, re) && self . eq_array_length ( ll, rl)
378+ self . eq_expr ( le, re) && self . eq_const_arg ( ll, rl)
387379 } ,
388380 ( ExprKind :: Ret ( l) , ExprKind :: Ret ( r) ) => both ( l. as_ref ( ) , r. as_ref ( ) , |l, r| self . eq_expr ( l, r) ) ,
389381 ( & ExprKind :: Struct ( l_path, lf, ref lo) , & ExprKind :: Struct ( r_path, rf, ref ro) ) => {
@@ -469,8 +461,10 @@ impl HirEqInterExpr<'_, '_, '_> {
469461 match ( & left. kind , & right. kind ) {
470462 ( ConstArgKind :: Path ( l_p) , ConstArgKind :: Path ( r_p) ) => self . eq_qpath ( l_p, r_p) ,
471463 ( ConstArgKind :: Anon ( l_an) , ConstArgKind :: Anon ( r_an) ) => self . eq_body ( l_an. body , r_an. body ) ,
464+ ( ConstArgKind :: Infer ( ..) , ConstArgKind :: Infer ( ..) ) => true ,
472465 // Use explicit match for now since ConstArg is undergoing flux.
473- ( ConstArgKind :: Path ( ..) , ConstArgKind :: Anon ( ..) ) | ( ConstArgKind :: Anon ( ..) , ConstArgKind :: Path ( ..) ) => {
466+ ( ConstArgKind :: Path ( ..) , ConstArgKind :: Anon ( ..) ) | ( ConstArgKind :: Anon ( ..) , ConstArgKind :: Path ( ..) )
467+ | ( ConstArgKind :: Infer ( ..) , _) | ( _, ConstArgKind :: Infer ( ..) ) => {
474468 false
475469 } ,
476470 }
@@ -589,7 +583,7 @@ impl HirEqInterExpr<'_, '_, '_> {
589583 pub fn eq_ty ( & mut self , left : & Ty < ' _ > , right : & Ty < ' _ > ) -> bool {
590584 match ( & left. kind , & right. kind ) {
591585 ( & TyKind :: Slice ( l_vec) , & TyKind :: Slice ( r_vec) ) => self . eq_ty ( l_vec, r_vec) ,
592- ( & TyKind :: Array ( lt, ll) , & TyKind :: Array ( rt, rl) ) => self . eq_ty ( lt, rt) && self . eq_array_length ( ll, rl) ,
586+ ( & TyKind :: Array ( lt, ll) , & TyKind :: Array ( rt, rl) ) => self . eq_ty ( lt, rt) && self . eq_const_arg ( ll, rl) ,
593587 ( TyKind :: Ptr ( l_mut) , TyKind :: Ptr ( r_mut) ) => l_mut. mutbl == r_mut. mutbl && self . eq_ty ( l_mut. ty , r_mut. ty ) ,
594588 ( TyKind :: Ref ( _, l_rmut) , TyKind :: Ref ( _, r_rmut) ) => {
595589 l_rmut. mutbl == r_rmut. mutbl && self . eq_ty ( l_rmut. ty , r_rmut. ty )
@@ -1002,7 +996,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
1002996 } ,
1003997 ExprKind :: Repeat ( e, len) => {
1004998 self . hash_expr ( e) ;
1005- self . hash_array_length ( len) ;
999+ self . hash_const_arg ( len) ;
10061000 } ,
10071001 ExprKind :: Ret ( ref e) => {
10081002 if let Some ( e) = * e {
@@ -1195,7 +1189,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
11951189 } ,
11961190 & TyKind :: Array ( ty, len) => {
11971191 self . hash_ty ( ty) ;
1198- self . hash_array_length ( len) ;
1192+ self . hash_const_arg ( len) ;
11991193 } ,
12001194 TyKind :: Pat ( ty, pat) => {
12011195 self . hash_ty ( ty) ;
@@ -1246,13 +1240,6 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12461240 }
12471241 }
12481242
1249- pub fn hash_array_length ( & mut self , length : ArrayLen < ' _ > ) {
1250- match length {
1251- ArrayLen :: Infer ( ..) => { } ,
1252- ArrayLen :: Body ( ct) => self . hash_const_arg ( ct) ,
1253- }
1254- }
1255-
12561243 pub fn hash_body ( & mut self , body_id : BodyId ) {
12571244 // swap out TypeckResults when hashing a body
12581245 let old_maybe_typeck_results = self . maybe_typeck_results . replace ( self . cx . tcx . typeck_body ( body_id) ) ;
@@ -1264,6 +1251,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12641251 match & const_arg. kind {
12651252 ConstArgKind :: Path ( path) => self . hash_qpath ( path) ,
12661253 ConstArgKind :: Anon ( anon) => self . hash_body ( anon. body ) ,
1254+ ConstArgKind :: Infer ( ..) => { } ,
12671255 }
12681256 }
12691257
0 commit comments