Skip to content

Commit dfe0f88

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35754 - QuietMisdreavus:must-use-reference, r=Manishearth
Add `must_use` to the Reference I'm a bit uncertain about the exact phrasing, but having it mentioned at all is probably better than before.
2 parents ef9786c + 0384722 commit dfe0f88

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/doc/reference.md

+3
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,9 @@ macro scope.
20712071
trait of the same name. `{Self}` will be replaced with the type that is supposed
20722072
to implement the trait but doesn't. To use this, the `on_unimplemented` feature gate
20732073
must be enabled.
2074+
- `must_use` - on structs and enums, will warn if a value of this type isn't used or
2075+
assigned to a variable. You may also include an optional message by using
2076+
`#[must_use = "message"]` which will be given alongside the warning.
20742077

20752078
### Conditional compilation
20762079

0 commit comments

Comments
 (0)