@@ -22,8 +22,8 @@ use rustc_infer::infer::{DefineOpaqueTypes, InferResult};
2222use rustc_lint:: builtin:: SELF_CONSTRUCTOR_FROM_OUTER_ITEM ;
2323use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment , AutoBorrow , AutoBorrowMutability } ;
2424use rustc_middle:: ty:: {
25- self , AdtKind , CanonicalUserType , GenericArgKind , GenericArgsRef , GenericParamDefKind ,
26- IsIdentity , Ty , TyCtxt , TypeFoldable , TypeVisitable , TypeVisitableExt , UserArgs , UserSelfTy ,
25+ self , AdtKind , CanonicalUserType , GenericArgsRef , GenericParamDefKind , IsIdentity , Ty , TyCtxt ,
26+ TypeFoldable , TypeVisitable , TypeVisitableExt , UserArgs , UserSelfTy ,
2727} ;
2828use rustc_middle:: { bug, span_bug} ;
2929use rustc_session:: lint;
@@ -573,7 +573,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
573573 /// Registers an obligation for checking later, during regionck, that `arg` is well-formed.
574574 pub ( crate ) fn register_wf_obligation (
575575 & self ,
576- arg : ty:: GenericArg < ' tcx > ,
576+ term : ty:: Term < ' tcx > ,
577577 span : Span ,
578578 code : traits:: ObligationCauseCode < ' tcx > ,
579579 ) {
@@ -583,16 +583,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
583583 self . tcx ,
584584 cause,
585585 self . param_env ,
586- ty:: Binder :: dummy ( ty :: PredicateKind :: Clause ( ty :: ClauseKind :: WellFormed ( arg ) ) ) ,
586+ ty:: ClauseKind :: WellFormed ( term ) ,
587587 ) ) ;
588588 }
589589
590590 /// Registers obligations that all `args` are well-formed.
591591 pub ( crate ) fn add_wf_bounds ( & self , args : GenericArgsRef < ' tcx > , span : Span ) {
592- for arg in args. iter ( ) . filter ( |arg| {
593- matches ! ( arg. unpack( ) , GenericArgKind :: Type ( ..) | GenericArgKind :: Const ( ..) )
594- } ) {
595- self . register_wf_obligation ( arg, span, ObligationCauseCode :: WellFormed ( None ) ) ;
592+ for term in args. iter ( ) . filter_map ( ty:: GenericArg :: as_term) {
593+ self . register_wf_obligation ( term, span, ObligationCauseCode :: WellFormed ( None ) ) ;
596594 }
597595 }
598596
0 commit comments