-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
#[must_use] on traits in stdlib #56677
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
LGTM and should probably be merged as is but I'd like to see a crater run to make sure we're not causing a lot of pain in the ecosystem by introducing these checks :) @bors try |
#[must_use] on traits in stdlib Based on #55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
☀️ Test successful - status-travis |
@craterbot run start=master#3a75e80557a103497cffbcab395a2f37061a77ea end=try#aa9aa79c3c583aab59ac9134542d60a780c35e2e mode=check-only |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
@bors r+ rollup |
📌 Commit 3246f49 has been approved by |
#[must_use] on traits in stdlib Based on rust-lang#55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
@@ -98,6 +98,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {} | |||
message="`{Self}` is not an iterator" | |||
)] | |||
#[doc(spotlight)] | |||
#[must_use] |
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.
This should be:
#[must_use] | |
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] |
(which can be fixed in a follow up PR)
#[must_use] on traits in stdlib Based on rust-lang#55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
#[must_use] on traits in stdlib Based on rust-lang#55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
#[must_use] on traits in stdlib Based on rust-lang#55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
#[must_use] on traits in stdlib Based on rust-lang#55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
#[must_use] on traits in stdlib Based on rust-lang#55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
I'm slightly worried about this. Does this mean that |
These only apply to trait objects, not concrete types implementing the traits I believe. |
#[must_use] on traits in stdlib Based on rust-lang#55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
Rollup of 7 pull requests Successful merges: - #56677 (#[must_use] on traits in stdlib) - #56679 (overhaul external doc attribute diagnostics) - #56682 (Update the stdsimd submodule) - #56691 (fix install broken link) - #56710 (Always set the RDRAND and RDSEED features on SGX) - #56713 (Test capacity of ZST vector) - #56841 (Add some unit tests to compiletest) Failed merges: r? @ghost
Based on #55506.
Adds
#[must_use]
attribute to traits in the stdlib:Iterator
Future
FnOnce
Fn
FnMut
There may be other traits that should have the attribute, but I couldn't find/think of any.