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
544
544
// to recompute this goal.
545
545
HasChanged :: Yes => None ,
546
546
HasChanged :: No => {
547
- // Remove the unconstrained RHS arg, which is expected to have changed.
548
547
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.
549
560
if let Some ( normalizes_to) = goal. predicate . as_normalizes_to ( ) {
550
561
let normalizes_to = normalizes_to. skip_binder ( ) ;
551
562
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>(
120
120
false ,
121
121
) ,
122
122
Ok ( GoalEvaluation { certainty : Certainty :: Yes , .. } ) => {
123
- bug ! (
123
+ span_bug ! (
124
+ root_obligation. cause. span,
124
125
"did not expect successful goal when collecting ambiguity errors for `{:?}`" ,
125
126
infcx. resolve_vars_if_possible( root_obligation. predicate) ,
126
127
)
127
128
}
128
129
Err ( _) => {
129
- bug ! (
130
+ span_bug ! (
131
+ root_obligation. cause. span,
130
132
"did not expect selection error when collecting ambiguity errors for `{:?}`" ,
131
133
infcx. resolve_vars_if_possible( root_obligation. predicate) ,
132
134
)
You can’t perform that action at this time.
0 commit comments