diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-11-22 13:25:48 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-11-22 19:14:09 +0100 |
| commit | 60d9c2c239a401e88c118e6df34584adef4c4ebb (patch) | |
| tree | 6e2351fe0f4c538a66539fb3b7474100e7fb0d41 /src | |
| parent | ea62c2e5b31cec7f540784cc1fad84b7c0006e3f (diff) | |
| download | rust-60d9c2c239a401e88c118e6df34584adef4c4ebb.tar.gz rust-60d9c2c239a401e88c118e6df34584adef4c4ebb.zip | |
Improve E0023 long error explanation
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0023.md | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustc_error_codes/error_codes/E0023.md b/src/librustc_error_codes/error_codes/E0023.md index 23a9d22a60d..c1d85705da3 100644 --- a/src/librustc_error_codes/error_codes/E0023.md +++ b/src/librustc_error_codes/error_codes/E0023.md @@ -2,11 +2,18 @@ A pattern attempted to extract an incorrect number of fields from a variant. Erroneous code example: -``` +```compile_fail,E0023 enum Fruit { Apple(String, String), Pear(u32), } + +let x = Fruit::Apple(String::new(), String::new()); + +match x { + Fruit::Apple(a) => {}, // error! + _ => {} +} ``` A pattern used to match against an enum variant must provide a sub-pattern for |
