File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
rustc_next_trait_solver/src/solve/eval_ctxt
rustc_trait_selection/src/solve/fulfill Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -544,8 +544,19 @@ where
544544 // to recompute this goal.
545545 HasChanged :: Yes => None ,
546546 HasChanged :: No => {
547- // Remove the unconstrained RHS arg, which is expected to have changed.
548547 let mut stalled_vars = orig_values;
548+
549+ // Remove the canonicalized universal vars, since we only care about stalled existentials.
550+ stalled_vars. retain ( |arg| match arg. kind ( ) {
551+ ty:: GenericArgKind :: Type ( ty) => matches ! ( ty. kind( ) , ty:: Infer ( _) ) ,
552+ ty:: GenericArgKind :: Const ( ct) => {
553+ matches ! ( ct. kind( ) , ty:: ConstKind :: Infer ( _) )
554+ }
555+ // Lifetimes can never stall goals.
556+ ty:: GenericArgKind :: Lifetime ( _) => false ,
557+ } ) ;
558+
559+ // Remove the unconstrained RHS arg, which is expected to have changed.
549560 if let Some ( normalizes_to) = goal. predicate . as_normalizes_to ( ) {
550561 let normalizes_to = normalizes_to. skip_binder ( ) ;
551562 let rhs_arg: I :: GenericArg = normalizes_to. term . into ( ) ;
Original file line number Diff line number Diff line change @@ -120,13 +120,15 @@ pub(super) fn fulfillment_error_for_stalled<'tcx>(
120120 false ,
121121 ) ,
122122 Ok ( GoalEvaluation { certainty : Certainty :: Yes , .. } ) => {
123- bug ! (
123+ span_bug ! (
124+ root_obligation. cause. span,
124125 "did not expect successful goal when collecting ambiguity errors for `{:?}`" ,
125126 infcx. resolve_vars_if_possible( root_obligation. predicate) ,
126127 )
127128 }
128129 Err ( _) => {
129- bug ! (
130+ span_bug ! (
131+ root_obligation. cause. span,
130132 "did not expect selection error when collecting ambiguity errors for `{:?}`" ,
131133 infcx. resolve_vars_if_possible( root_obligation. predicate) ,
132134 )
You can’t perform that action at this time.
0 commit comments