-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-UnicodeArea: UnicodeArea: UnicodeA-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code (playground):
match 'a' {
'\u{0}'..='\u{D7FF}' | '\u{E000}'..='\u{10_FFFF}' => {},
'\u{D7FF}'..='\u{E000}' => {}, // should be unreachable
}
The first pattern by itself is exhaustive, because it covers all the valid chars. The second pattern looks like it includes more chars than the first, but it doesn't, because those extra chars are all invalid. So the second pattern should be marked unreachable.
This fails on all rust versions on the playground, and I think it's been that way since we implemented exhaustive_integer_patterns
. I discovered it while working on the exhaustiveness algorithm.
@rustbot modify labels: +A-exhaustiveness-checking
Metadata
Metadata
Assignees
Labels
A-UnicodeArea: UnicodeArea: UnicodeA-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.