Rollup merge of #119835 - Nadrieril:simplify-empty-logic, r=compiler-errors

Exhaustiveness: simplify empty pattern logic

The logic that handles empty patterns had gotten quite convoluted. This PR simplifies it a lot. I tried to make the logic as easy as possible to follow; this only does logically equivalent changes.

The first commit is a drive-by comment clarification that was requested after another PR a while back.

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger
2024-01-19 19:27:00 +01:00
committed by GitHub
4 changed files with 30 additions and 51 deletions

View File

@@ -56,7 +56,7 @@ impl<'p, 'tcx> PatternColumn<'p, 'tcx> {
) -> Result<SplitConstructorSet<'p, 'tcx>, ErrorGuaranteed> {
let column_ctors = self.patterns.iter().map(|p| p.ctor());
let ctors_for_ty = &pcx.ctors_for_ty()?;
Ok(ctors_for_ty.split(pcx, column_ctors))
Ok(ctors_for_ty.split(column_ctors))
}
/// Does specialization: given a constructor, this takes the patterns from the column that match