compiler/rustc_error_codes/src/error_codes/E0002.md MARKDOWN 30 lines View on github.com → Search inside
1#### Note: this error code is no longer emitted by the compiler.23This error indicates that an empty match expression is invalid because the type4it is matching on is non-empty (there exist values of this type). In safe code5it is impossible to create an instance of an empty type, so empty match6expressions are almost never desired. This error is typically fixed by adding7one or more cases to the match expression.89An example of an empty type is `enum Empty { }`. So, the following will work:1011```12enum Empty {}1314fn foo(x: Empty) {15    match x {16        // empty17    }18}19```2021However, this won't:2223```compile_fail24fn foo(x: Option<String>) {25    match x {26        // empty27    }28}29```

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.