@@ -164,7 +164,7 @@ pub fn clause_obligations<'tcx>(
164164 wf. compute ( ty. into ( ) ) ;
165165 }
166166 ty:: ClauseKind :: Projection ( t) => {
167- wf. compute_projection ( t. projection_ty ) ;
167+ wf. compute_alias ( t. projection_ty ) ;
168168 wf. compute ( match t. term . unpack ( ) {
169169 ty:: TermKind :: Ty ( ty) => ty. into ( ) ,
170170 ty:: TermKind :: Const ( c) => c. into ( ) ,
@@ -436,9 +436,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
436436 }
437437 }
438438
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
440440 /// into `self.out`.
441- fn compute_projection ( & mut self , data : ty:: AliasTy < ' tcx > ) {
441+ fn compute_alias ( & mut self , data : ty:: AliasTy < ' tcx > ) {
442442 // A projection is well-formed if
443443 //
444444 // (a) its predicates hold (*)
@@ -466,6 +466,9 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
466466 self . compute_projection_args ( data. args ) ;
467467 }
468468
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`.
469472 fn compute_inherent_projection ( & mut self , data : ty:: AliasTy < ' tcx > ) {
470473 // An inherent projection is well-formed if
471474 //
@@ -688,8 +691,8 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
688691 // Simple cases that are WF if their type args are WF.
689692 }
690693
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) ;
693696 return ; // Subtree handled by compute_projection.
694697 }
695698 ty:: Alias ( ty:: Inherent , data) => {
@@ -791,21 +794,6 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
791794 // types appearing in the fn signature.
792795 }
793796
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-
809797 ty:: Dynamic ( data, r, _) => {
810798 // WfObject
811799 //
0 commit comments