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