Don't ICE on pending obligations from deep normalization in a loop

This commit is contained in:
Michael Goulet 2025-04-18 23:36:17 +00:00
parent 191df20fca
commit 47911eb677
4 changed files with 163 additions and 14 deletions

View file

@ -77,7 +77,15 @@ impl<'tcx> At<'_, 'tcx> {
.into_value_registering_obligations(self.infcx, &mut *fulfill_cx);
let errors = fulfill_cx.select_all_or_error(self.infcx);
let value = self.infcx.resolve_vars_if_possible(value);
if errors.is_empty() { Ok(value) } else { Err(errors) }
if errors.is_empty() {
Ok(value)
} else {
// Drop pending obligations, since deep normalization may happen
// in a loop and we don't want to trigger the assertion on the next
// iteration due to pending ambiguous obligations we've left over.
let _ = fulfill_cx.collect_remaining_errors(self.infcx);
Err(errors)
}
}
}
}