about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/lib.rs
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2023-12-11 17:57:53 +0100
committerNadrieril <nadrieril+git@gmail.com>2023-12-15 16:57:36 +0100
commit3ad76f93256c0869aafeb1404f494f00e6d5b5ae (patch)
tree262a396288e1b7b0cb3724f195056951e787317d /compiler/rustc_pattern_analysis/src/lib.rs
parent081c3dcf43e31ea2c5226ead3639a500b3ac3049 (diff)
downloadrust-3ad76f93256c0869aafeb1404f494f00e6d5b5ae.tar.gz
rust-3ad76f93256c0869aafeb1404f494f00e6d5b5ae.zip
Disentangle the arena from `MatchCheckCtxt`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/lib.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs
index 07730aa49d3..f19dc7345fc 100644
--- a/compiler/rustc_pattern_analysis/src/lib.rs
+++ b/compiler/rustc_pattern_analysis/src/lib.rs
@@ -39,17 +39,19 @@ pub fn analyze_match<'p, 'tcx>(
     arms: &[MatchArm<'p, 'tcx>],
     scrut_ty: Ty<'tcx>,
 ) -> UsefulnessReport<'p, 'tcx> {
+    // Arena to store the extra wildcards we construct during analysis.
+    let wildcard_arena = cx.pattern_arena;
     let pat_column = PatternColumn::new(arms);
 
-    let report = compute_match_usefulness(cx, arms, scrut_ty);
+    let report = compute_match_usefulness(cx, arms, scrut_ty, wildcard_arena);
 
     // Lint on ranges that overlap on their endpoints, which is likely a mistake.
-    lint_overlapping_range_endpoints(cx, &pat_column);
+    lint_overlapping_range_endpoints(cx, &pat_column, wildcard_arena);
 
     // Run the non_exhaustive_omitted_patterns lint. Only run on refutable patterns to avoid hitting
     // `if let`s. Only run if the match is exhaustive otherwise the error is redundant.
     if cx.refutable && report.non_exhaustiveness_witnesses.is_empty() {
-        lint_nonexhaustive_missing_variants(cx, arms, &pat_column, scrut_ty)
+        lint_nonexhaustive_missing_variants(cx, arms, &pat_column, scrut_ty, wildcard_arena)
     }
 
     report