Only check for errors in predicate when skipping impl assembly
Prior to PR #91205, checking for errors in the overall obligation would check checking the `ParamEnv`, due to an incorrect `super_visit_with` impl. With this bug fixed, we will now bail out of impl candidate assembly if the `ParamEnv` contains any error types. In practice, this appears to be overly conservative - when an error occurs early in compilation, we end up giving up early for some predicates that we could have successfully evaluated without overflow. By only checking for errors in the predicate itself, we avoid causing additional spurious 'type annotations needed' errors after a 'real' error has already occurred. With this PR, the diagnostic changes caused by PR #91205 are reverted.
This commit is contained in:
parent
5fd3a5c7c1
commit
d18065d997
6 changed files with 28 additions and 32 deletions
|
@ -536,7 +536,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// This helps us avoid overflow: see issue #72839
|
||||
// Since compilation is already guaranteed to fail, this is just
|
||||
// to try to show the 'nicest' possible errors to the user.
|
||||
if obligation.references_error() {
|
||||
// We don't check for errors in the `ParamEnv` - in practice,
|
||||
// it seems to cause us to be overly aggressive in deciding
|
||||
// to give up searching for candidates, leading to spurious errors.
|
||||
if obligation.predicate.references_error() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue