Add documentation for the must_use attribute#157957
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @GuillaumeGomez (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 (
|
This comment has been minimized.
This comment has been minimized.
f817c7a to
9624b7f
Compare
| /// compiler warns through the [`unused_must_use`] lint. | ||
| /// | ||
| /// This is most common on types that represent an important state or outcome. For example, | ||
| /// [`Result`] is marked `#[must_use]` because ignoring an error value can hide a failed operation. |
There was a problem hiding this comment.
Please add a code example illustrating this and also show the compiler message.
|
Reminder, once the PR becomes ready for a review, use |
:D |
9624b7f to
58870a5
Compare
Document the built-in `must_use` attribute in the standard library using the `#[doc(attribute = "...")]` mechanism, following the existing `keyword_docs.rs` pattern.
58870a5 to
72b3123
Compare
|
As this is the first, and so will be a kind of template for later ones, @ehuss, I'm particularly interested to hear your thoughts here. |
|
@rustbot ready |
|
Seems fine to me. |
|
Then let's go! @bors r=GuillaumeGomez,ehuss rollup |
…uwer Rollup of 6 pull requests Successful merges: - #157816 (make more slice mutable ref getters rustc_no_writable) - #156788 (Document that destructors in running threads are not run on program exit) - #157957 (Add documentation for the `must_use` attribute) - #158006 (Simplify `HardwiredLints` and `SoftLints`) - #158007 (Pin dependencies) - #158025 (Enable `symbol_intern_string_literal` lint for rustdoc)
|
@bors r=GuillaumeGomez,ehuss,traviscross rollup |
Rollup merge of #157957 - softfault:docs-must-use-attribute, r=GuillaumeGomez,ehuss Add documentation for the `must_use` attribute Document the built-in `must_use` attribute in the standard library using the `#[doc(attribute = "...")]` mechanism, following the existing `keyword_docs.rs` pattern. Part of #157604. r? @GuillaumeGomez Tested with `./x test library/std --doc`.
…uwer Rollup of 6 pull requests Successful merges: - rust-lang/rust#157816 (make more slice mutable ref getters rustc_no_writable) - rust-lang/rust#156788 (Document that destructors in running threads are not run on program exit) - rust-lang/rust#157957 (Add documentation for the `must_use` attribute) - rust-lang/rust#158006 (Simplify `HardwiredLints` and `SoftLints`) - rust-lang/rust#158007 (Pin dependencies) - rust-lang/rust#158025 (Enable `symbol_intern_string_literal` lint for rustdoc)
Document the built-in
must_useattribute in the standard library using the#[doc(attribute = "...")]mechanism, following the existingkeyword_docs.rspattern.Part of #157604.
r? @GuillaumeGomez
Tested with
./x test library/std --doc.