diff options
| author | bors <bors@rust-lang.org> | 2024-01-07 13:36:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-07 13:36:54 +0000 |
| commit | d8b44d2802ab665b183dce06d527bf09175dd8cf (patch) | |
| tree | 7b370d34fc1cd43aaa2a2fa405b6aaa223239a81 /compiler/rustc_pattern_analysis/src/lints.rs | |
| parent | 87e1430893d55001034bd76c5dbe832d80bc50c3 (diff) | |
| parent | 50b197c6ee0c42df56020bd4c5d8e393411fb8c0 (diff) | |
| download | rust-d8b44d2802ab665b183dce06d527bf09175dd8cf.tar.gz rust-d8b44d2802ab665b183dce06d527bf09175dd8cf.zip | |
Auto merge of #119667 - Nadrieril:remove-wildcard-row, r=compiler-errors
Exhaustiveness: remove `Matrix.wildcard_row` To compute exhaustiveness, we check whether an extra row with a wildcard added at the end of the match expression would be reachable. We used to store an actual such row of patterns in the `Matrix`, but it's a bit redundant since we know it only contains wildcards. It was kept because we used it to get the type of each column (and relevancy). With this PR, we keep track of the types (and relevancy) directly. This is part of me splitting up https://github.com/rust-lang/rust/pull/119581 for ease of review. r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lints.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lints.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lints.rs b/compiler/rustc_pattern_analysis/src/lints.rs index 83210a4a556..f1237ecf83c 100644 --- a/compiler/rustc_pattern_analysis/src/lints.rs +++ b/compiler/rustc_pattern_analysis/src/lints.rs @@ -83,8 +83,9 @@ impl<'p, 'tcx> PatternColumn<'p, 'tcx> { (0..arity).map(|_| Self { patterns: Vec::new() }).collect(); let relevant_patterns = self.patterns.iter().filter(|pat| ctor.is_covered_by(pcx, pat.ctor())); + let ctor_sub_tys = pcx.ctor_sub_tys(ctor); for pat in relevant_patterns { - let specialized = pat.specialize(pcx, ctor); + let specialized = pat.specialize(pcx, ctor, ctor_sub_tys); for (subpat, column) in specialized.iter().zip(&mut specialized_columns) { if subpat.is_or_pat() { column.patterns.extend(subpat.flatten_or_pat()) |
