rust-lang / rust-lang/rust

Missing arm should recommend adding an arm

Open
#159,686 3 comments 0 reactions 1 assignee View on GitHub

@jakubadamw is already working on this.

Since Jul 21, 2026.

A-diagnostics A-parser D-confusing E-easy T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
fn matches(d: Option<u32>) {
    match d {
        Some(d) => {},
        None,
    }
}
Current output
Compiling playground v0.0.1 (/playground)
error: unexpected `,` in pattern
  --> src/lib.rs:11:13
   |
11 |         None,
   |             ^
   |
help: try adding parentheses to match on a tuple...
   |
11 |         (None,)
   |         +     +
help: ...or a vertical bar to match on alternatives
   |
11 -         None,
11 +         None |
   |

error: could not compile `playground` (lib) due to 1 previous error
Desired output
Compiling playground v0.0.1 (/playground)
error: unexpected `,` in pattern, missing arm?
  --> src/lib.rs:11:13
   |
11 |         None,
   |             ^
   |
help: try adding an arm
   |
11 |         None => {},
   |              +++++

error: could not compile `playground` (lib) due to 1 previous error
Rationale and extra context

No response

Other cases

Rust Version
1.97.1 (current playground stable)
Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.