@@ -164,7 +164,7 @@ pub fn clause_obligations<'tcx>(
164
164
wf. compute ( ty. into ( ) ) ;
165
165
}
166
166
ty:: ClauseKind :: Projection ( t) => {
167
- wf. compute_projection ( t. projection_ty ) ;
167
+ wf. compute_alias ( t. projection_ty ) ;
168
168
wf. compute ( match t. term . unpack ( ) {
169
169
ty:: TermKind :: Ty ( ty) => ty. into ( ) ,
170
170
ty:: TermKind :: Const ( c) => c. into ( ) ,
@@ -436,9 +436,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
436
436
}
437
437
}
438
438
439
- /// Pushes the obligations required for `trait_ref::Item` to be WF
439
+ /// Pushes the obligations required for an alias (except inherent) to be WF
440
440
/// into `self.out`.
441
- fn compute_projection ( & mut self , data : ty:: AliasTy < ' tcx > ) {
441
+ fn compute_alias ( & mut self , data : ty:: AliasTy < ' tcx > ) {
442
442
// A projection is well-formed if
443
443
//
444
444
// (a) its predicates hold (*)
@@ -466,6 +466,8 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
466
466
self . compute_projection_args ( data. args ) ;
467
467
}
468
468
469
+ /// Pushes the obligations required for an inherent alias to be WF
470
+ /// into `self.out`.
469
471
fn compute_inherent_projection ( & mut self , data : ty:: AliasTy < ' tcx > ) {
470
472
// An inherent projection is well-formed if
471
473
//
@@ -688,8 +690,8 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
688
690
// Simple cases that are WF if their type args are WF.
689
691
}
690
692
691
- ty:: Alias ( ty:: Projection , data) => {
692
- self . compute_projection ( data) ;
693
+ ty:: Alias ( ty:: Projection | ty :: Opaque | ty :: Weak , data) => {
694
+ self . compute_alias ( data) ;
693
695
return ; // Subtree handled by compute_projection.
694
696
}
695
697
ty:: Alias ( ty:: Inherent , data) => {
@@ -791,21 +793,6 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
791
793
// types appearing in the fn signature.
792
794
}
793
795
794
- ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id, args, .. } ) => {
795
- // All of the requirements on type parameters
796
- // have already been checked for `impl Trait` in
797
- // return position. We do need to check type-alias-impl-trait though.
798
- if self . tcx ( ) . is_type_alias_impl_trait ( def_id) {
799
- let obligations = self . nominal_obligations ( def_id, args) ;
800
- self . out . extend ( obligations) ;
801
- }
802
- }
803
-
804
- ty:: Alias ( ty:: Weak , ty:: AliasTy { def_id, args, .. } ) => {
805
- let obligations = self . nominal_obligations ( def_id, args) ;
806
- self . out . extend ( obligations) ;
807
- }
808
-
809
796
ty:: Dynamic ( data, r, _) => {
810
797
// WfObject
811
798
//
0 commit comments