diff options
| author | bors <bors@rust-lang.org> | 2019-03-30 08:32:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-03-30 08:32:13 +0000 |
| commit | 6c49da45441d29aadd5935dabbaa8dc09ebad33a (patch) | |
| tree | e3d8f54b557abdf322de702d4757293149e687c5 /src/doc | |
| parent | 709b72e7a73cbb798b728fd84c384bd0ad8ebf6c (diff) | |
| parent | 62a78c4fcfca82cbdcdd13a5298885bd21e5d4d9 (diff) | |
| download | rust-6c49da45441d29aadd5935dabbaa8dc09ebad33a.tar.gz rust-6c49da45441d29aadd5935dabbaa8dc09ebad33a.zip | |
Auto merge of #59550 - Centril:rollup, r=Centril
Rollup of 10 pull requests Successful merges: - #59376 (RFC 2008: Enum Variants) - #59453 (Recover from parse error in tuple syntax) - #59455 (Account for short-hand field syntax when suggesting borrow) - #59499 (Fix broken download link in the armhf-gnu image) - #59512 (implement `AsRawFd` for stdio locks) - #59525 (Whitelist some rustc attrs) - #59528 (Improve the dbg! macro docs ) - #59532 (In doc examples, don't ignore read/write results) - #59534 (rustdoc: collapse blanket impls in the same way as normal impls) - #59537 (Fix OnceWith docstring.) Failed merges: r? @ghost
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/non-exhaustive.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/doc/unstable-book/src/language-features/non-exhaustive.md b/src/doc/unstable-book/src/language-features/non-exhaustive.md index f9840e1b83f..907147c17ef 100644 --- a/src/doc/unstable-book/src/language-features/non-exhaustive.md +++ b/src/doc/unstable-book/src/language-features/non-exhaustive.md @@ -7,10 +7,12 @@ The tracking issue for this feature is: [#44109] ------------------------ The `non_exhaustive` gate allows you to use the `#[non_exhaustive]` attribute -on structs and enums. When applied within a crate, users of the crate will need -to use the `_` pattern when matching enums and use the `..` pattern when -matching structs. Structs marked as `non_exhaustive` will not be able to be -created normally outside of the defining crate. This is demonstrated below: +on structs, enums and enum variants. When applied within a crate, users of the +crate will need to use the `_` pattern when matching enums and use the `..` +pattern when matching structs. Enum variants cannot be matched against. +Structs and enum variants marked as `non_exhaustive` will not be able to +be created normally outside of the defining crate. This is demonstrated +below: ```rust,ignore (pseudo-Rust) use std::error::Error as StdError; @@ -72,4 +74,3 @@ let config = Config { window_width: 640, window_height: 480 }; // when marked non_exhaustive. let &Config { window_width, window_height, .. } = config; ``` - |
