compiler/rustc_error_codes/src/error_codes/E0005.md MARKDOWN 31 lines View on github.com → Search inside
1Patterns used to bind names must be irrefutable, that is, they must guarantee2that a name will be extracted in all cases.34Erroneous code example:56```compile_fail,E00057let x = Some(1);8let Some(y) = x;9// error: refutable pattern in local binding: `None` not covered10```1112If you encounter this error you probably need to use a `match` or `if let` to13deal with the possibility of failure. Example:1415```16let x = Some(1);1718match x {19    Some(y) => {20        // do something21    },22    None => {}23}2425// or:2627if let Some(y) = x {28    // do something29}30```

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.