Add #[must_use] attribute to Coroutine trait by henryksloan · Pull Request #129034 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation4 Commits1 Checks6 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

henryksloan

Coroutines tracking issue

Like closures (FnOnce, AsyncFn, etc.), coroutines are lazy and do nothing unless called (resumed). Closure traits like FnOnce have #[must_use = "closures are lazy and do nothing unless called"] to catch likely bugs for users of APIs that produce them. This PR adds such a #[must_use] attribute to trait Coroutine.

@rustbot

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joboet (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Aug 13, 2024

@rust-log-analyzer

This comment has been minimized.

@henryksloan

@joboet

Makes sense! This seems entirely uncontroversial, so
@bors r+ rollup

@bors

📌 Commit 1e445f4 has been approved by joboet

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Aug 13, 2024

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request

Aug 13, 2024

@GuillaumeGomez

…joboet

Add #[must_use] attribute to Coroutine trait

Coroutines tracking issue

Like closures (FnOnce, AsyncFn, etc.), coroutines are lazy and do nothing unless called (resumed). Closure traits like FnOnce have #[must_use = "closures are lazy and do nothing unless called"] to catch likely bugs for users of APIs that produce them. This PR adds such a #[must_use] attribute to trait Coroutine.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 13, 2024

@bors

…llaumeGomez

Rollup of 7 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 13, 2024

@bors

…iaskrgr

Rollup of 7 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 14, 2024

@bors

…iaskrgr

Rollup of 7 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Aug 14, 2024

@bors

…iaskrgr

Rollup of 7 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Aug 14, 2024

@rust-timer

Rollup merge of rust-lang#129034 - henryksloan:coroutine-must-use, r=joboet

Add #[must_use] attribute to Coroutine trait

Coroutines tracking issue

Like closures (FnOnce, AsyncFn, etc.), coroutines are lazy and do nothing unless called (resumed). Closure traits like FnOnce have #[must_use = "closures are lazy and do nothing unless called"] to catch likely bugs for users of APIs that produce them. This PR adds such a #[must_use] attribute to trait Coroutine.

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.