Commit 91c4318
feat(selfhost): add RS0021 (NON_EXHAUSTIVE_MATCH) to the rss checker
Port match-exhaustiveness (crate::analyzer::exhaustiveness, simplified for the
corpus) into selfhost/check.rss as the 17th parity code. A match statement or
expression is non-exhaustive unless a guardless arm set covers its scrutinee:
Some/None (Option), Ok/Err (Result), true/false (Bool), every variant of a
declared sum, an irrefutable pattern for a single-constructor tuple/struct, a
capping rest pattern for List, or a `_` wildcard. Malformed (no `=>`) and
guarded arms contribute no coverage.
Scrutinee root inference mirrors hir_expr_type_name: a let-bound local resolves
through its RHS (constructor / unqualified-fn return type), a param through its
declared type, qualified calls and `?`-unwrapped expressions fall back to the
builtin Some/None|Ok/Err rule. Copies find_top_sym/find_top_if/is_kw_text from
astdump; the arm walk reuses next_line_or_block_end.
Real sum decls are distinguished from a variable literally named `sum` (the
lexer tags every "sum" text with WORD_SUM) via a line-start/`pub`-guarded probe.
checker_parity_corpus: 619/619, 0 mismatches, 0 run-failures (17 codes).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 183e10a commit 91c4318
2 files changed
Lines changed: 606 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
506 | | - | |
| 506 | + | |
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| |||
0 commit comments