Skip to content

Consider #[must_use] annotation on async fn as also affecting the Future::Output - #100633

Merged
bors merged 4 commits into
rust-lang:masterfrom
estebank:must_use_async_fn_return
Nov 11, 2022
Merged

Consider #[must_use] annotation on async fn as also affecting the Future::Output#100633
bors merged 4 commits into
rust-lang:masterfrom
estebank:must_use_async_fn_return

Conversation

@estebank

Copy link
Copy Markdown
Contributor

No longer lint against #[must_use] async fn foo().

When encountering a statement that awaits on a Future, check if the
Future's parent item is annotated with #[must_use] and emit a lint
if so. This effectively makes must_use an annotation on the
Future::Output instead of only the Future itself.

Fix #78149.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[must_use] on async fns works on returned Future instead of the awaited value