@@ -22,8 +22,8 @@ use rustc_infer::infer::{DefineOpaqueTypes, InferResult};
22
22
use rustc_lint:: builtin:: SELF_CONSTRUCTOR_FROM_OUTER_ITEM ;
23
23
use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment , AutoBorrow , AutoBorrowMutability } ;
24
24
use 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 ,
27
27
} ;
28
28
use rustc_middle:: { bug, span_bug} ;
29
29
use rustc_session:: lint;
@@ -573,7 +573,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
573
573
/// Registers an obligation for checking later, during regionck, that `arg` is well-formed.
574
574
pub ( crate ) fn register_wf_obligation (
575
575
& self ,
576
- arg : ty:: GenericArg < ' tcx > ,
576
+ term : ty:: Term < ' tcx > ,
577
577
span : Span ,
578
578
code : traits:: ObligationCauseCode < ' tcx > ,
579
579
) {
@@ -583,16 +583,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
583
583
self . tcx ,
584
584
cause,
585
585
self . param_env ,
586
- ty:: Binder :: dummy ( ty :: PredicateKind :: Clause ( ty :: ClauseKind :: WellFormed ( arg ) ) ) ,
586
+ ty:: ClauseKind :: WellFormed ( term ) ,
587
587
) ) ;
588
588
}
589
589
590
590
/// Registers obligations that all `args` are well-formed.
591
591
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 ) ) ;
596
594
}
597
595
}
598
596
0 commit comments