-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Inconsistent borrow check in async function #74068
Comments
If
In rustc 1.42.0 both errors are reported simultaneously (godbolt). I'm not sure whether this is a bug or not - rustc need not report everything wrong with a crate in one go, but if it can report these simultaneously then it probably should. |
I have found the answer.
|
Thanks for digging into this, @SNCPlay42! This doesn't appear to be async-related, so removing that tag. |
If @SNCPlay42's bisection is correct (thanks!), then this was triggered by #67681 (cc @matthewjasper). It is indeed true that the code example is not expected to compile, though you could make it compile by either using if map.contains(..) {
if let Some(...) = ... {
...
}
} I'm not sure exactly what caused this to occur, but it makes sense that #67681 might be related since that affected how we manage opaque type inference (and the async fn implicitly uses an opaque return type). |
The error is being suppressed because |
Prioritized as |
Both errors are reported now. This is a polonius problem, I believe. |
I tried this code:
f2
seems to be correct but can not be compiled.Meta
According to the playground, the problem exists on
1.44.1
and1.46.0-nightly (2020-07-04 0cd7ff7ddfb75a38dca8)
.Other versions may be the same.
The text was updated successfully, but these errors were encountered: