File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
compiler/rustc_trait_selection/src/solve Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -63,17 +63,27 @@ 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) => Some ( normalizes_to. self_ty ( ) ) ,
74+ _ => None ,
75+ } ;
76+ if let Some ( self_ty) = self_ty && self . shallow_resolve ( self_ty) . is_ty_var ( )
6877 // We don't do this fast path when opaques are defined since we may
6978 // eventually use opaques to incompletely guide inference via ty var
7079 // self types.
7180 // FIXME: Properly consider opaques here.
7281 && self . inner . borrow_mut ( ) . opaque_types ( ) . is_empty ( )
73- {
74- return Some ( Certainty :: AMBIGUOUS ) ;
75- }
82+ {
83+ return Some ( Certainty :: AMBIGUOUS ) ;
84+ }
7685
86+ if let Some ( trait_pred) = goal. predicate . as_trait_clause ( ) {
7787 if trait_pred. polarity ( ) == ty:: PredicatePolarity :: Positive {
7888 match self . 0 . tcx . as_lang_item ( trait_pred. def_id ( ) ) {
7989 Some ( LangItem :: Sized ) | Some ( LangItem :: MetaSized ) => {
You can’t perform that action at this time.
0 commit comments