@@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHasher;
7
7
use rustc_hir:: MatchSource :: TryDesugar ;
8
8
use rustc_hir:: def:: { DefKind , Res } ;
9
9
use rustc_hir:: {
10
- ArrayLen , AssocItemConstraint , BinOpKind , BindingMode , Block , BodyId , Closure , ConstArg , ConstArgKind , Expr ,
10
+ AssocItemConstraint , BinOpKind , BindingMode , Block , BodyId , Closure , ConstArg , ConstArgKind , Expr ,
11
11
ExprField , ExprKind , FnRetTy , GenericArg , GenericArgs , HirId , HirIdMap , InlineAsmOperand , LetExpr , Lifetime ,
12
12
LifetimeName , Pat , PatField , PatKind , Path , PathSegment , PrimTy , QPath , Stmt , StmtKind , TraitBoundModifiers , Ty ,
13
13
TyKind ,
@@ -266,14 +266,6 @@ impl HirEqInterExpr<'_, '_, '_> {
266
266
} )
267
267
}
268
268
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
-
277
269
pub fn eq_body ( & mut self , left : BodyId , right : BodyId ) -> bool {
278
270
// swap out TypeckResults when hashing a body
279
271
let old_maybe_typeck_results = self . inner . maybe_typeck_results . replace ( (
@@ -383,7 +375,7 @@ impl HirEqInterExpr<'_, '_, '_> {
383
375
} ,
384
376
( ExprKind :: Path ( l) , ExprKind :: Path ( r) ) => self . eq_qpath ( l, r) ,
385
377
( & 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)
387
379
} ,
388
380
( ExprKind :: Ret ( l) , ExprKind :: Ret ( r) ) => both ( l. as_ref ( ) , r. as_ref ( ) , |l, r| self . eq_expr ( l, r) ) ,
389
381
( & ExprKind :: Struct ( l_path, lf, ref lo) , & ExprKind :: Struct ( r_path, rf, ref ro) ) => {
@@ -469,8 +461,10 @@ impl HirEqInterExpr<'_, '_, '_> {
469
461
match ( & left. kind , & right. kind ) {
470
462
( ConstArgKind :: Path ( l_p) , ConstArgKind :: Path ( r_p) ) => self . eq_qpath ( l_p, r_p) ,
471
463
( ConstArgKind :: Anon ( l_an) , ConstArgKind :: Anon ( r_an) ) => self . eq_body ( l_an. body , r_an. body ) ,
464
+ ( ConstArgKind :: Infer ( ..) , ConstArgKind :: Infer ( ..) ) => true ,
472
465
// 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 ( ..) ) => {
474
468
false
475
469
} ,
476
470
}
@@ -589,7 +583,7 @@ impl HirEqInterExpr<'_, '_, '_> {
589
583
pub fn eq_ty ( & mut self , left : & Ty < ' _ > , right : & Ty < ' _ > ) -> bool {
590
584
match ( & left. kind , & right. kind ) {
591
585
( & 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) ,
593
587
( TyKind :: Ptr ( l_mut) , TyKind :: Ptr ( r_mut) ) => l_mut. mutbl == r_mut. mutbl && self . eq_ty ( l_mut. ty , r_mut. ty ) ,
594
588
( TyKind :: Ref ( _, l_rmut) , TyKind :: Ref ( _, r_rmut) ) => {
595
589
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> {
1002
996
} ,
1003
997
ExprKind :: Repeat ( e, len) => {
1004
998
self . hash_expr ( e) ;
1005
- self . hash_array_length ( len) ;
999
+ self . hash_const_arg ( len) ;
1006
1000
} ,
1007
1001
ExprKind :: Ret ( ref e) => {
1008
1002
if let Some ( e) = * e {
@@ -1195,7 +1189,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
1195
1189
} ,
1196
1190
& TyKind :: Array ( ty, len) => {
1197
1191
self . hash_ty ( ty) ;
1198
- self . hash_array_length ( len) ;
1192
+ self . hash_const_arg ( len) ;
1199
1193
} ,
1200
1194
TyKind :: Pat ( ty, pat) => {
1201
1195
self . hash_ty ( ty) ;
@@ -1246,13 +1240,6 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
1246
1240
}
1247
1241
}
1248
1242
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
-
1256
1243
pub fn hash_body ( & mut self , body_id : BodyId ) {
1257
1244
// swap out TypeckResults when hashing a body
1258
1245
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> {
1264
1251
match & const_arg. kind {
1265
1252
ConstArgKind :: Path ( path) => self . hash_qpath ( path) ,
1266
1253
ConstArgKind :: Anon ( anon) => self . hash_body ( anon. body ) ,
1254
+ ConstArgKind :: Infer ( ..) => { } ,
1267
1255
}
1268
1256
}
1269
1257
0 commit comments