@@ -63,17 +63,34 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
6363 goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
6464 span : Span ,
6565 ) -> Option < Certainty > {
66- if let Some ( trait_pred) = goal. predicate . as_trait_clause ( ) {
67- if self . shallow_resolve ( trait_pred. self_ty ( ) . skip_binder ( ) ) . is_ty_var ( )
66+ let self_ty = match goal. predicate . kind ( ) . skip_binder ( ) {
67+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( trait_pred) ) => {
68+ Some ( trait_pred. self_ty ( ) )
69+ }
70+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( proj_pred) ) => {
71+ Some ( proj_pred. self_ty ( ) )
72+ }
73+ ty:: PredicateKind :: NormalizesTo ( normalizes_to)
74+ if matches ! (
75+ normalizes_to. alias. kind( self . tcx) ,
76+ ty:: AliasTermKind :: ProjectionTy | ty:: AliasTermKind :: ProjectionConst
77+ ) =>
78+ {
79+ Some ( normalizes_to. self_ty ( ) )
80+ }
81+ _ => None ,
82+ } ;
83+ if let Some ( self_ty) = self_ty && self . shallow_resolve ( self_ty) . is_ty_var ( )
6884 // We don't do this fast path when opaques are defined since we may
6985 // eventually use opaques to incompletely guide inference via ty var
7086 // self types.
7187 // FIXME: Properly consider opaques here.
7288 && self . inner . borrow_mut ( ) . opaque_types ( ) . is_empty ( )
73- {
74- return Some ( Certainty :: AMBIGUOUS ) ;
75- }
89+ {
90+ return Some ( Certainty :: AMBIGUOUS ) ;
91+ }
7692
93+ if let Some ( trait_pred) = goal. predicate . as_trait_clause ( ) {
7794 if trait_pred. polarity ( ) == ty:: PredicatePolarity :: Positive {
7895 match self . 0 . tcx . as_lang_item ( trait_pred. def_id ( ) ) {
7996 Some ( LangItem :: Sized ) | Some ( LangItem :: MetaSized ) => {
0 commit comments