]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0001.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0001.md
1 #### Note: this error code is no longer emitted by the compiler.
2
3 This error suggests that the expression arm corresponding to the noted pattern
4 will never be reached as for all possible values of the expression being
5 matched, one of the preceding patterns will match.
6
7 This means that perhaps some of the preceding patterns are too general, this
8 one is too specific or the ordering is incorrect.
9
10 For example, the following `match` block has too many arms:
11
12 ```
13 match Some(0) {
14     Some(bar) => {/* ... */}
15     x => {/* ... */} // This handles the `None` case
16     _ => {/* ... */} // All possible cases have already been handled
17 }
18 ```
19
20 `match` blocks have their patterns matched in order, so, for example, putting
21 a wildcard arm above a more specific arm will make the latter arm irrelevant.
22
23 Ensure the ordering of the match arm is correct and remove any superfluous
24 arms.