diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-01-15 21:51:48 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-15 21:51:48 +0900 |
| commit | 20c49fc79755fbe12fac48485582ce8d9b367175 (patch) | |
| tree | b5319f165d08f28ce3bbdaee78406be2dfa85568 | |
| parent | be1ecce01feddf3c81e0a1215a7dc21814d35862 (diff) | |
| parent | 6801cf436bf3549db72c364a912da43ac38d0e79 (diff) | |
| download | rust-20c49fc79755fbe12fac48485582ce8d9b367175.tar.gz rust-20c49fc79755fbe12fac48485582ce8d9b367175.zip | |
Rollup merge of #68211 - GuillaumeGomez:add-failing-example-e0170, r=Dylan-DPC
Add failing example for E0170 explanation r? @Dylan-DPC
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0170.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0170.md b/src/librustc_error_codes/error_codes/E0170.md index 4b870dbf221..9678cd173b7 100644 --- a/src/librustc_error_codes/error_codes/E0170.md +++ b/src/librustc_error_codes/error_codes/E0170.md @@ -1,3 +1,24 @@ +A pattern binding is using the same name as one of the variants of a type. + +Erroneous code example: + +```compile_fail,E0170 +# #![deny(warnings)] +enum Method { + GET, + POST, +} + +fn is_empty(s: Method) -> bool { + match s { + GET => true, + _ => false + } +} + +fn main() {} +``` + Enum variants are qualified by default. For example, given this type: ``` |
