@@ -613,12 +613,8 @@ pub(super) fn implied_predicates_with_filter<'tcx>(
613
613
let mut bounds = Bounds :: default ( ) ;
614
614
icx. lowerer ( ) . lower_bounds ( self_param_ty, superbounds, & mut bounds, ty:: List :: empty ( ) , filter) ;
615
615
616
- let where_bounds_that_match = icx. probe_ty_param_bounds_in_generics (
617
- generics,
618
- item. owner_id . def_id ,
619
- self_param_ty,
620
- filter,
621
- ) ;
616
+ let where_bounds_that_match =
617
+ icx. probe_ty_param_bounds_in_generics ( generics, item. owner_id . def_id , filter) ;
622
618
623
619
// Combine the two lists to form the complete set of superbounds:
624
620
let implied_bounds =
@@ -765,7 +761,6 @@ pub(super) fn type_param_predicates<'tcx>(
765
761
( item_def_id, def_id, assoc_name) : ( LocalDefId , LocalDefId , Ident ) ,
766
762
) -> ty:: EarlyBinder < ' tcx , & ' tcx [ ( ty:: Clause < ' tcx > , Span ) ] > {
767
763
use rustc_hir:: * ;
768
- use rustc_middle:: ty:: Ty ;
769
764
770
765
// In the HIR, bounds can derive from two places. Either
771
766
// written inline like `<T: Foo>` or in a where-clause like
@@ -775,7 +770,6 @@ pub(super) fn type_param_predicates<'tcx>(
775
770
let param_owner = tcx. hir ( ) . ty_param_owner ( def_id) ;
776
771
let generics = tcx. generics_of ( param_owner) ;
777
772
let index = generics. param_def_id_to_index [ & def_id. to_def_id ( ) ] ;
778
- let ty = Ty :: new_param ( tcx, index, tcx. hir ( ) . ty_param_name ( def_id) ) ;
779
773
780
774
// Don't look for bounds where the type parameter isn't in scope.
781
775
let parent = if item_def_id == param_owner {
@@ -812,7 +806,6 @@ pub(super) fn type_param_predicates<'tcx>(
812
806
icx. probe_ty_param_bounds_in_generics (
813
807
hir_generics,
814
808
def_id,
815
- ty,
816
809
PredicateFilter :: SelfThatDefines ( assoc_name) ,
817
810
)
818
811
. into_iter ( )
@@ -838,7 +831,6 @@ impl<'tcx> ItemCtxt<'tcx> {
838
831
& self ,
839
832
hir_generics : & ' tcx hir:: Generics < ' tcx > ,
840
833
param_def_id : LocalDefId ,
841
- ty : Ty < ' tcx > ,
842
834
filter : PredicateFilter ,
843
835
) -> Vec < ( ty:: Clause < ' tcx > , Span ) > {
844
836
let mut bounds = Bounds :: default ( ) ;
@@ -848,13 +840,21 @@ impl<'tcx> ItemCtxt<'tcx> {
848
840
continue ;
849
841
} ;
850
842
851
- let bound_ty = if predicate. is_param_bound ( param_def_id. to_def_id ( ) ) {
852
- ty
853
- } else if matches ! ( filter, PredicateFilter :: All ) {
854
- self . lowerer ( ) . lower_ty_maybe_return_type_notation ( predicate. bounded_ty )
855
- } else {
856
- continue ;
857
- } ;
843
+ match filter {
844
+ _ if predicate. is_param_bound ( param_def_id. to_def_id ( ) ) => {
845
+ // Ok
846
+ }
847
+ PredicateFilter :: All => {
848
+ // Ok
849
+ }
850
+ PredicateFilter :: SelfOnly
851
+ | PredicateFilter :: SelfThatDefines ( _)
852
+ | PredicateFilter :: SelfConstIfConst
853
+ | PredicateFilter :: SelfAndAssociatedTypeBounds => continue ,
854
+ PredicateFilter :: ConstIfConst => unreachable ! ( ) ,
855
+ }
856
+
857
+ let bound_ty = self . lowerer ( ) . lower_ty_maybe_return_type_notation ( predicate. bounded_ty ) ;
858
858
859
859
let bound_vars = self . tcx . late_bound_vars ( predicate. hir_id ) ;
860
860
self . lowerer ( ) . lower_bounds (
0 commit comments