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 }})
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
.
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 author
: the review is finished, PR author should check the comments and take action accordingly@rustbot review
: the author is ready for a review, this PR will be queued again in the reviewer's queue
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the library team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
Makes sense! This seems entirely uncontroversial, so
@bors r+ rollup
📌 Commit 1e445f4 has been approved by joboet
It is now in the queue for this repository.
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
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request
…joboet
Add #[must_use]
attribute to Coroutine
trait
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
…llaumeGomez
Rollup of 7 pull requests
Successful merges:
- rust-lang#127857 (Allow to customize
// TODO:
comment for deprecated safe autofix) - rust-lang#128410 (Migrate
remap-path-prefix-dwarf
run-make
test to rmake) - rust-lang#128828 (
-Znext-solver
caching) - rust-lang#128873 (Add windows-targets crate to std's sysroot)
- rust-lang#129034 (Add
#[must_use]
attribute toCoroutine
trait) - rust-lang#129049 (compiletest: Don't panic on unknown JSON-like output lines)
- rust-lang#129050 (Emit a warning instead of an error if
--generate-link-to-definition
is used with other output formats than HTML)
r? @ghost
@rustbot
modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 7 pull requests
Successful merges:
- rust-lang#122884 (Optimize integer
pow
by removing the exit branch) - rust-lang#127857 (Allow to customize
// TODO:
comment for deprecated safe autofix) - rust-lang#129034 (Add
#[must_use]
attribute toCoroutine
trait) - rust-lang#129049 (compiletest: Don't panic on unknown JSON-like output lines)
- rust-lang#129050 (Emit a warning instead of an error if
--generate-link-to-definition
is used with other output formats than HTML) - rust-lang#129056 (Fix one usage of target triple in bootstrap)
- rust-lang#129058 (Add mw back to review rotation)
r? @ghost
@rustbot
modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 7 pull requests
Successful merges:
- rust-lang#122884 (Optimize integer
pow
by removing the exit branch) - rust-lang#127857 (Allow to customize
// TODO:
comment for deprecated safe autofix) - rust-lang#129034 (Add
#[must_use]
attribute toCoroutine
trait) - rust-lang#129049 (compiletest: Don't panic on unknown JSON-like output lines)
- rust-lang#129050 (Emit a warning instead of an error if
--generate-link-to-definition
is used with other output formats than HTML) - rust-lang#129056 (Fix one usage of target triple in bootstrap)
- rust-lang#129058 (Add mw back to review rotation)
r? @ghost
@rustbot
modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 7 pull requests
Successful merges:
- rust-lang#122884 (Optimize integer
pow
by removing the exit branch) - rust-lang#127857 (Allow to customize
// TODO:
comment for deprecated safe autofix) - rust-lang#129034 (Add
#[must_use]
attribute toCoroutine
trait) - rust-lang#129049 (compiletest: Don't panic on unknown JSON-like output lines)
- rust-lang#129050 (Emit a warning instead of an error if
--generate-link-to-definition
is used with other output formats than HTML) - rust-lang#129056 (Fix one usage of target triple in bootstrap)
- rust-lang#129058 (Add mw back to review rotation)
r? @ghost
@rustbot
modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#129034 - henryksloan:coroutine-must-use, r=joboet
Add #[must_use]
attribute to Coroutine
trait
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
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the library team, which will review and decide on the PR/issue.