Filter out universals and lifetimes from stalled_vars
This commit is contained in:
@@ -544,8 +544,19 @@ where
|
|||||||
// to recompute this goal.
|
// to recompute this goal.
|
||||||
HasChanged::Yes => None,
|
HasChanged::Yes => None,
|
||||||
HasChanged::No => {
|
HasChanged::No => {
|
||||||
// Remove the unconstrained RHS arg, which is expected to have changed.
|
|
||||||
let mut stalled_vars = orig_values;
|
let mut stalled_vars = orig_values;
|
||||||
|
|
||||||
|
// Remove the canonicalized universal vars, since we only care about stalled existentials.
|
||||||
|
stalled_vars.retain(|arg| match arg.kind() {
|
||||||
|
ty::GenericArgKind::Type(ty) => matches!(ty.kind(), ty::Infer(_)),
|
||||||
|
ty::GenericArgKind::Const(ct) => {
|
||||||
|
matches!(ct.kind(), ty::ConstKind::Infer(_))
|
||||||
|
}
|
||||||
|
// Lifetimes can never stall goals.
|
||||||
|
ty::GenericArgKind::Lifetime(_) => false,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove the unconstrained RHS arg, which is expected to have changed.
|
||||||
if let Some(normalizes_to) = goal.predicate.as_normalizes_to() {
|
if let Some(normalizes_to) = goal.predicate.as_normalizes_to() {
|
||||||
let normalizes_to = normalizes_to.skip_binder();
|
let normalizes_to = normalizes_to.skip_binder();
|
||||||
let rhs_arg: I::GenericArg = normalizes_to.term.into();
|
let rhs_arg: I::GenericArg = normalizes_to.term.into();
|
||||||
|
|||||||
@@ -120,13 +120,15 @@ pub(super) fn fulfillment_error_for_stalled<'tcx>(
|
|||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
Ok(GoalEvaluation { certainty: Certainty::Yes, .. }) => {
|
Ok(GoalEvaluation { certainty: Certainty::Yes, .. }) => {
|
||||||
bug!(
|
span_bug!(
|
||||||
|
root_obligation.cause.span,
|
||||||
"did not expect successful goal when collecting ambiguity errors for `{:?}`",
|
"did not expect successful goal when collecting ambiguity errors for `{:?}`",
|
||||||
infcx.resolve_vars_if_possible(root_obligation.predicate),
|
infcx.resolve_vars_if_possible(root_obligation.predicate),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
bug!(
|
span_bug!(
|
||||||
|
root_obligation.cause.span,
|
||||||
"did not expect selection error when collecting ambiguity errors for `{:?}`",
|
"did not expect selection error when collecting ambiguity errors for `{:?}`",
|
||||||
infcx.resolve_vars_if_possible(root_obligation.predicate),
|
infcx.resolve_vars_if_possible(root_obligation.predicate),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user