@@ -17,7 +17,7 @@ use rustc_lint::LateContext;
17
17
use rustc_middle:: mir:: interpret:: { ConstValue , Scalar } ;
18
18
use rustc_middle:: ty:: {
19
19
self , layout:: ValidityRequirement , AdtDef , AliasTy , AssocKind , Binder , BoundRegion , FnSig , IntTy , List , ParamEnv ,
20
- Predicate , PredicateKind , Region , RegionKind , SubstsRef , Ty , TyCtxt , TypeSuperVisitable , TypeVisitable ,
20
+ Region , RegionKind , SubstsRef , Ty , TyCtxt , TypeSuperVisitable , TypeVisitable ,
21
21
TypeVisitableExt , TypeVisitor , UintTy , VariantDef , VariantDiscr ,
22
22
} ;
23
23
use rustc_middle:: ty:: { GenericArg , GenericArgKind } ;
@@ -563,7 +563,7 @@ fn is_uninit_value_valid_for_ty_fallback<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'t
563
563
}
564
564
565
565
/// Gets an iterator over all predicates which apply to the given item.
566
- pub fn all_predicates_of ( tcx : TyCtxt < ' _ > , id : DefId ) -> impl Iterator < Item = & ( Predicate < ' _ > , Span ) > {
566
+ pub fn all_predicates_of ( tcx : TyCtxt < ' _ > , id : DefId ) -> impl Iterator < Item = & ( ty :: Clause < ' _ > , Span ) > {
567
567
let mut next_id = Some ( id) ;
568
568
iter:: from_fn ( move || {
569
569
next_id. take ( ) . map ( |id| {
@@ -665,7 +665,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
665
665
ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id, substs, .. } ) => sig_from_bounds (
666
666
cx,
667
667
ty,
668
- cx. tcx . item_bounds ( def_id) . subst_iter ( cx. tcx , substs) . map ( |c| c . as_predicate ( ) ) ,
668
+ cx. tcx . item_bounds ( def_id) . subst_iter ( cx. tcx , substs) ,
669
669
cx. tcx . opt_parent ( def_id) ,
670
670
) ,
671
671
ty:: FnPtr ( sig) => Some ( ExprFnSig :: Sig ( sig, None ) ) ,
@@ -698,7 +698,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
698
698
fn sig_from_bounds < ' tcx > (
699
699
cx : & LateContext < ' tcx > ,
700
700
ty : Ty < ' tcx > ,
701
- predicates : impl IntoIterator < Item = Predicate < ' tcx > > ,
701
+ predicates : impl IntoIterator < Item = ty :: Clause < ' tcx > > ,
702
702
predicates_id : Option < DefId > ,
703
703
) -> Option < ExprFnSig < ' tcx > > {
704
704
let mut inputs = None ;
@@ -707,7 +707,7 @@ fn sig_from_bounds<'tcx>(
707
707
708
708
for pred in predicates {
709
709
match pred. kind ( ) . skip_binder ( ) {
710
- PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( p) )
710
+ ty:: ClauseKind :: Trait ( p)
711
711
if ( lang_items. fn_trait ( ) == Some ( p. def_id ( ) )
712
712
|| lang_items. fn_mut_trait ( ) == Some ( p. def_id ( ) )
713
713
|| lang_items. fn_once_trait ( ) == Some ( p. def_id ( ) ) )
@@ -720,7 +720,7 @@ fn sig_from_bounds<'tcx>(
720
720
}
721
721
inputs = Some ( i) ;
722
722
} ,
723
- PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( p) )
723
+ ty:: ClauseKind :: Projection ( p)
724
724
if Some ( p. projection_ty . def_id ) == lang_items. fn_once_output ( ) && p. projection_ty . self_ty ( ) == ty =>
725
725
{
726
726
if output. is_some ( ) {
@@ -937,7 +937,7 @@ pub fn adt_and_variant_of_res<'tcx>(cx: &LateContext<'tcx>, res: Res) -> Option<
937
937
}
938
938
939
939
/// Checks if the type is a type parameter implementing `FnOnce`, but not `FnMut`.
940
- pub fn ty_is_fn_once_param < ' tcx > ( tcx : TyCtxt < ' _ > , ty : Ty < ' tcx > , predicates : & ' tcx [ Predicate < ' _ > ] ) -> bool {
940
+ pub fn ty_is_fn_once_param < ' tcx > ( tcx : TyCtxt < ' _ > , ty : Ty < ' tcx > , predicates : & ' tcx [ ty :: Clause < ' _ > ] ) -> bool {
941
941
let ty:: Param ( ty) = * ty. kind ( ) else {
942
942
return false ;
943
943
} ;
@@ -950,7 +950,7 @@ pub fn ty_is_fn_once_param<'tcx>(tcx: TyCtxt<'_>, ty: Ty<'tcx>, predicates: &'tc
950
950
predicates
951
951
. iter ( )
952
952
. try_fold ( false , |found, p| {
953
- if let PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( p) ) = p. kind ( ) . skip_binder ( )
953
+ if let ty:: ClauseKind :: Trait ( p) = p. kind ( ) . skip_binder ( )
954
954
&& let ty:: Param ( self_ty) = p. trait_ref . self_ty ( ) . kind ( )
955
955
&& ty. index == self_ty. index
956
956
{
0 commit comments