-
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
warn on must_use use on async fn's #89610
Conversation
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
cc @eholk since this is an async-polish item Before r+ing, I need to double check if we need to get the ok from the lang team before adding new warnings |
Looks good to me! |
Nominating for lang team discussion. This PR adds a new warning that detects
|
I suspect this might just be an oversight in this PR, but it seems like this should be an If so, then I suspect it need not receive T-lang approval... though that is a little murky these days :) |
T-lang discussed this in today's meeting and agreed that this can move ahead. We may eventually want to make the must_use have behavior related to return of the We briefly discussed my concern around unused_attributes and generally felt positive about its use here, I think. |
@wesleywiser what review is outstanding? |
@guswynn I believe this is still waiting on Mark's feedback to be addressed:
|
@wesleywiser sorry about the delay, was on a break, this should now be ready! |
This comment has been minimized.
This comment has been minimized.
f61d916
to
958de5a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @guswynn!
@bors r+ |
📌 Commit 958de5a has been approved by |
warn on must_use use on async fn's As referenced in rust-lang#78149 This only works on `async` fn's for now, I can also look into if I can get `Box<dyn Future>` and `impl Future` working at this level (hir)
warn on must_use use on async fn's As referenced in rust-lang#78149 This only works on `async` fn's for now, I can also look into if I can get `Box<dyn Future>` and `impl Future` working at this level (hir)
Co-authored-by: Yuki Okushi <jtitor@2k36.org>
e75a0ad
to
83ce771
Compare
Blessed tests. @bors r+ |
📌 Commit 83ce771 has been approved by |
warn on must_use use on async fn's As referenced in rust-lang#78149 This only works on `async` fn's for now, I can also look into if I can get `Box<dyn Future>` and `impl Future` working at this level (hir)
warn on must_use use on async fn's As referenced in rust-lang#78149 This only works on `async` fn's for now, I can also look into if I can get `Box<dyn Future>` and `impl Future` working at this level (hir)
warn on must_use use on async fn's As referenced in rust-lang#78149 This only works on `async` fn's for now, I can also look into if I can get `Box<dyn Future>` and `impl Future` working at this level (hir)
warn on must_use use on async fn's As referenced in rust-lang#78149 This only works on `async` fn's for now, I can also look into if I can get `Box<dyn Future>` and `impl Future` working at this level (hir)
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#89610 (warn on must_use use on async fn's) - rust-lang#90667 (Improve diagnostics when a static lifetime is expected) - rust-lang#90687 (Permit const panics in stable const contexts in stdlib) - rust-lang#90772 (Add Vec::retain_mut) - rust-lang#90861 (Print escaped string if char literal has multiple characters, but only one printable character) - rust-lang#90884 (Fix span for non-satisfied trivial trait bounds) - rust-lang#90900 (Remove workaround for the forward progress handling in LLVM) - rust-lang#90901 (Improve ManuallyDrop suggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@wesleywiser you are a legend for blessing those tests, sorry this fell off my radar! |
@guswynn Thanks for working on it!! 🎉 |
The Future type that an async function implicitly returns is already implicitly marked as must_use, and additional must_use annotations on async functions are, therefore, redundant. These unneeded annotations generate a warning, which is an error in our build, with this change to the rust compiler rust-lang/rust#89610 Bug: 88999 Change-Id: I84685942c30eeaf98ad9597285d289d5bcbc12d3 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/608581 Reviewed-by: Abdulla Kamar <abdulla@google.com> Fuchsia-Auto-Submit: Adrian Danis <adanis@google.com> Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
As referenced in #78149
This only works on
async
fn's for now, I can also look into if I can getBox<dyn Future>
andimpl Future
working at this level (hir)