@@ -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,9 @@ 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`.
471
+ // FIXME(inherent_associated_types): Merge this function with `fn compute_alias`.
469
472
fn compute_inherent_projection ( & mut self , data : ty:: AliasTy < ' tcx > ) {
470
473
// An inherent projection is well-formed if
471
474
//
@@ -688,8 +691,8 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
688
691
// Simple cases that are WF if their type args are WF.
689
692
}
690
693
691
- ty:: Alias ( ty:: Projection , data) => {
692
- self . compute_projection ( data) ;
694
+ ty:: Alias ( ty:: Projection | ty :: Opaque | ty :: Weak , data) => {
695
+ self . compute_alias ( data) ;
693
696
return ; // Subtree handled by compute_projection.
694
697
}
695
698
ty:: Alias ( ty:: Inherent , data) => {
@@ -791,21 +794,6 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
791
794
// types appearing in the fn signature.
792
795
}
793
796
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
797
ty:: Dynamic ( data, r, _) => {
810
798
// WfObject
811
799
//
0 commit comments