1
Fork 0

only downgrade Error -> Ambiguous if type error is in predicate

This commit is contained in:
Michael Goulet 2022-04-06 21:10:43 -07:00
parent 8f36334ca9
commit 7bd22e29d0
5 changed files with 25 additions and 27 deletions

View file

@ -231,8 +231,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// `Err(Unimplemented)` to `Ok(None)`. This helps us avoid
// emitting additional spurious errors, since we're guaranteed
// to have emitted at least one.
if stack.obligation.references_error() {
debug!("no results for error type, treating as ambiguous");
if stack.obligation.predicate.references_error() {
debug!(?stack.obligation.predicate, "found error type in predicate, treating as ambiguous");
return Ok(None);
}
return Err(Unimplemented);