Conversation
Collaborator
|
r? @jackh726 rustbot has assigned @jackh726. Use Why was this reviewer chosen?The reviewer was selected based on:
|
kpreid
force-pushed
the
must-use-advice
branch
2 times, most recently
from
September 15, 2026 19:46
beef742 to
d08786b
Compare
This comment has been minimized.
This comment has been minimized.
The old message, “help: use `let _ = ...` to ignore the resulting value”, contains no indication that this is something that you might not want to do, and in fact can be read as saying that one *should* do this. The new message, “if you wish to disregard this recommendation and immediately drop the value, use `let _ = ...`”, is intended to make it clear that this is a choice, and choosing it has the particular effect of immediately dropping the value. A possible further improvement, not part of this change, might be to distinguish between types that are `must_use` and have a destructor (whose side-effects are likely relevant), and types that are `must_use` and do not have a destructor, where the timing is irrelevant and the consequence is just ignoring information that was provided. However, not every destructor is relevant to `must_use`; for example, `Result<(), Box<dyn Error>>` has a destructor and is `must_use`, but the destructor is only managing memory for the error value and it has no side effects relevant to the caller (unless the error in the box has side effects of its own).
kpreid
force-pushed
the
must-use-advice
branch
from
September 22, 2026 01:20
d08786b to
1f00c6c
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The old message, “help: use
let _ = ...to ignore the resulting value”, contains no indication that this is something that you might not want to do, and in fact can be read as saying that one should do this.The new message, “help: if you wish to disregard this recommendation and immediately drop the value, use
let _ = ...”, is intended to make it clear that this is a choice, and choosing it has the particular effect of immediately dropping the value.A possible further improvement, not part of this change, might be to distinguish between types that are
must_useand have a destructor (whose side-effects are likely relevant), and types that aremust_useand do not have a destructor, where the timing is irrelevant and the consequence is just ignoring information that was provided. However, not every destructor is relevant tomust_use; for example,Result<(), Box<dyn Error>>has a destructor and ismust_use, but the destructor is only managing memory for the error value and it has no side effects relevant to the caller (unless the error in the box has side effects of its own).Inspired by #t-lang > Lint for assigning drop guards to _
@rustbot label +A-lints +L-unused_must_use