Rollup merge of #95749 - compiler-errors:ambig, r=oli-obk

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

That is, we don't care if there's a TypeError type in the ParamEnv.

Fixes #95408
This commit is contained in:
Dylan DPC
2022-04-15 20:50:46 +02:00
committed by GitHub
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);