@@ -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 )
@@ -1008,7 +1002,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
10081002 } ,
10091003 ExprKind :: Repeat ( e, len) => {
10101004 self . hash_expr ( e) ;
1011- self . hash_array_length ( len) ;
1005+ self . hash_const_arg ( len) ;
10121006 } ,
10131007 ExprKind :: Ret ( ref e) => {
10141008 if let Some ( e) = * e {
@@ -1201,7 +1195,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12011195 } ,
12021196 & TyKind :: Array ( ty, len) => {
12031197 self . hash_ty ( ty) ;
1204- self . hash_array_length ( len) ;
1198+ self . hash_const_arg ( len) ;
12051199 } ,
12061200 TyKind :: Pat ( ty, pat) => {
12071201 self . hash_ty ( ty) ;
@@ -1252,13 +1246,6 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12521246 }
12531247 }
12541248
1255- pub fn hash_array_length ( & mut self , length : ArrayLen < ' _ > ) {
1256- match length {
1257- ArrayLen :: Infer ( ..) => { } ,
1258- ArrayLen :: Body ( ct) => self . hash_const_arg ( ct) ,
1259- }
1260- }
1261-
12621249 pub fn hash_body ( & mut self , body_id : BodyId ) {
12631250 // swap out TypeckResults when hashing a body
12641251 let old_maybe_typeck_results = self . maybe_typeck_results . replace ( self . cx . tcx . typeck_body ( body_id) ) ;
@@ -1270,6 +1257,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12701257 match & const_arg. kind {
12711258 ConstArgKind :: Path ( path) => self . hash_qpath ( path) ,
12721259 ConstArgKind :: Anon ( anon) => self . hash_body ( anon. body ) ,
1260+ ConstArgKind :: Infer ( ..) => { } ,
12731261 }
12741262 }
12751263
0 commit comments