-
Notifications
You must be signed in to change notification settings - Fork 13k
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
unreachable_code
warning when invoke .await
on async diverging function
#61798
Comments
We discussed this a bit on Zulip. The likely cause is that parts of the await desugaring are being linted against. We can likely check the span to see if the code that is being linted against is part of the async fn foo() {
return; bar().await;
}
async fn bar() {
} still gets a lint warning. |
Marking as deferred as this doesn't seem like a problem that needs to block stabilization. |
cc @varkor who has done some work on the inhabited logic stuff. |
I'm now getting this warning even for functions that loop but eventually return. It worked fine with nightly-2019-08-21, but the latest nightly (2019-09-17) is broken. For example, this code generates a warning:
with the warning repeated twice:
|
Can confirm. I believe this regressed somewhere after nightly 09-09-2019. |
I think I have this in my code here: https://github.com/MOZGIII/netsound/blob/cc16cd94c3b5d0e75e18719f223e205f4aaaadb0/src/net/recv.rs#L46 Can somebody confirm this? If not I'll file another bug report. |
@MOZGIII yeah that's the same, the function can "never" return from the unconditional loop. |
…it, r=petrochenkov Silence unreachable code lint from await desugaring Fixes rust-lang#61798. This PR silences the unreachable code lint when it originates from within an await desugaring.
I tried this code:
I expected to see this happen: no build warn
Instead, this happened:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: