-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Check for negative impls when finding auto traits #55356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes rust-lang#55321 When AutoTraitFinder begins examining a type, it checks for an explicit negative impl. However, it wasn't checking for negative impls found when calling 'select' on predicates found from nested obligations. This commit makes AutoTraitFinder check for negative impls whenever it makes a call to 'select'. If a negative impl is found, it immediately bails out. Normal users of SelectioContext don't need to worry about this, since they stop as soon as an Unimplemented error is encountered. However, we add predicates to our ParamEnv when we encounter this error, so we need to handle negative impls specially (so that we don't try adding them to our ParamEnv).
(rust_highfive has picked a reviewer for you, use r? to override) |
Ping from triage @nikomatsakis: This PR requires your review. |
Beta-nominating since the ICE this is fixing is on stable (and has been for a while). |
Co-Authored-By: Aaron1011 <aa1ronham@gmail.com>
Sorry for taking so long to review this. I see it's quite a small patch. To be honest, I'm still a bit nervous by the auto-trait finder code, so I kept putting off in order to do a more thorough "re-read" of that code, which is unfortunate. Anyway, seems fine for now. |
@bors r+ p=1 |
📌 Commit 56acb2a has been approved by |
Giving high priority because this is a regression and it's been sitting around a while. |
…sakis Check for negative impls when finding auto traits Fixes #55321 When AutoTraitFinder begins examining a type, it checks for an explicit negative impl. However, it wasn't checking for negative impls found when calling 'select' on predicates found from nested obligations. This commit makes AutoTraitFinder check for negative impls whenever it makes a call to 'select'. If a negative impl is found, it immediately bails out. Normal users of SelectioContext don't need to worry about this, since they stop as soon as an Unimplemented error is encountered. However, we add predicates to our ParamEnv when we encounter this error, so we need to handle negative impls specially (so that we don't try adding them to our ParamEnv).
☀️ Test successful - status-appveyor, status-travis |
We have decided to not backport this fix. It fixes a stable-to-stable regression that involves an unstable feature. Since it hasn’t been noticed for such a long time, it does not appear to be important enough to warrant a backport. |
Fixes #55321
When AutoTraitFinder begins examining a type, it checks for an explicit
negative impl. However, it wasn't checking for negative impls found when
calling 'select' on predicates found from nested obligations.
This commit makes AutoTraitFinder check for negative impls whenever it
makes a call to 'select'. If a negative impl is found, it immediately
bails out.
Normal users of SelectioContext don't need to worry about this, since
they stop as soon as an Unimplemented error is encountered. However, we
add predicates to our ParamEnv when we encounter this error, so we need
to handle negative impls specially (so that we don't try adding them to
our ParamEnv).