Correctly handle nested or-patterns in column-wise analyses

This commit is contained in:
Nadrieril 2023-10-30 15:31:00 +01:00
parent 9d6d5d4894
commit d5e836cf0c
2 changed files with 7 additions and 1 deletions

View File

@ -931,7 +931,7 @@ impl<'p, 'tcx> PatternColumn<'p, 'tcx> {
let specialized = pat.specialize(pcx, &ctor);
for (subpat, column) in specialized.iter().zip(&mut specialized_columns) {
if subpat.is_or_pat() {
column.patterns.extend(subpat.iter_fields())
column.patterns.extend(subpat.flatten_or_pat())
} else {
column.patterns.push(subpat)
}

View File

@ -35,4 +35,10 @@ fn main() {
((0, 0) | (1, 0),) => {}
_ => {}
}
// This one caused ICE https://github.com/rust-lang/rust/issues/117378
match (0u8, 0) {
(x @ 0 | x @ (1 | 2), _) => {}
(3.., _) => {}
}
}