@@ -1453,16 +1453,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1453
1453
. enumerate ( )
1454
1454
. skip ( 1 ) // Remove `Self` for `ExistentialPredicate`.
1455
1455
. map ( |( index, arg) | {
1456
- if let ty:: GenericArgKind :: Type ( ty) = arg. unpack ( ) {
1457
- debug ! ( ?ty) ;
1458
- if ty == dummy_self {
1459
- let param = & generics. params [ index] ;
1460
- missing_type_params. push ( param. name ) ;
1461
- return tcx. ty_error ( ) . into ( ) ;
1462
- } else if ty. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
1463
- references_self = true ;
1464
- return tcx. ty_error ( ) . into ( ) ;
1465
- }
1456
+ if arg == dummy_self. into ( ) {
1457
+ let param = & generics. params [ index] ;
1458
+ missing_type_params. push ( param. name ) ;
1459
+ return tcx. ty_error ( ) . into ( ) ;
1460
+ } else if arg. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
1461
+ references_self = true ;
1462
+ return tcx. ty_error ( ) . into ( ) ;
1466
1463
}
1467
1464
arg
1468
1465
} )
@@ -1509,10 +1506,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1509
1506
// Like for trait refs, verify that `dummy_self` did not leak inside default type
1510
1507
// parameters.
1511
1508
let references_self = b. projection_ty . substs . iter ( ) . skip ( 1 ) . any ( |arg| {
1512
- if let ty:: GenericArgKind :: Type ( ty) = arg. unpack ( ) {
1513
- if ty == dummy_self || ty. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
1514
- return true ;
1515
- }
1509
+ if arg. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
1510
+ return true ;
1516
1511
}
1517
1512
false
1518
1513
} ) ;
@@ -1524,7 +1519,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1524
1519
. substs
1525
1520
. iter ( )
1526
1521
. map ( |arg| {
1527
- if let ty :: GenericArgKind :: Type ( _ ) = arg . unpack ( ) {
1522
+ if arg . walk ( ) . any ( |arg| arg == dummy_self . into ( ) ) {
1528
1523
return tcx. ty_error ( ) . into ( ) ;
1529
1524
}
1530
1525
arg
0 commit comments