about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/lints.rs
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-01-15 19:17:28 +0100
committerNadrieril <nadrieril+git@gmail.com>2024-01-15 19:27:06 +0100
commit8b66f497ebe3458226dbcc91501b5dd1c1728b45 (patch)
tree7b5888f93b7fddb07a7f048e34532b4bd0183507 /compiler/rustc_pattern_analysis/src/lints.rs
parent1ead4761e9e2f056385768614c23ffa7acb6a19e (diff)
downloadrust-8b66f497ebe3458226dbcc91501b5dd1c1728b45.tar.gz
rust-8b66f497ebe3458226dbcc91501b5dd1c1728b45.zip
Lint overlapping ranges directly from exhaustiveness
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lints.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/lints.rs32
1 files changed, 3 insertions, 29 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lints.rs b/compiler/rustc_pattern_analysis/src/lints.rs
index cfe4ca3ce93..4266e2a405e 100644
--- a/compiler/rustc_pattern_analysis/src/lints.rs
+++ b/compiler/rustc_pattern_analysis/src/lints.rs
@@ -1,14 +1,11 @@
-use rustc_session::lint;
 use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
 use rustc_span::ErrorGuaranteed;
 
-use crate::errors::{
-    self, NonExhaustiveOmittedPattern, NonExhaustiveOmittedPatternLintOnArm, Uncovered,
-};
+use crate::errors::{NonExhaustiveOmittedPattern, NonExhaustiveOmittedPatternLintOnArm, Uncovered};
 use crate::pat::PatOrWild;
 use crate::rustc::{
-    self, Constructor, DeconstructedPat, MatchArm, MatchCtxt, PlaceCtxt, RevealedTy,
-    RustcMatchCheckCtxt, SplitConstructorSet, WitnessPat,
+    Constructor, DeconstructedPat, MatchArm, MatchCtxt, PlaceCtxt, RevealedTy, RustcMatchCheckCtxt,
+    SplitConstructorSet, WitnessPat,
 };
 
 /// A column of patterns in the matrix, where a column is the intuitive notion of "subpatterns that
@@ -196,26 +193,3 @@ pub(crate) fn lint_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
     }
     Ok(())
 }
-
-pub(crate) fn lint_overlapping_range_endpoints<'a, 'p, 'tcx>(
-    cx: MatchCtxt<'a, 'p, 'tcx>,
-    overlapping_range_endpoints: &[rustc::OverlappingRanges<'p, 'tcx>],
-) {
-    let rcx = cx.tycx;
-    for overlap in overlapping_range_endpoints {
-        let overlap_as_pat = rcx.hoist_pat_range(&overlap.overlaps_on, overlap.pat.ty());
-        let overlaps: Vec<_> = overlap
-            .overlaps_with
-            .iter()
-            .map(|pat| pat.data().unwrap().span)
-            .map(|span| errors::Overlap { range: overlap_as_pat.clone(), span })
-            .collect();
-        let pat_span = overlap.pat.data().unwrap().span;
-        rcx.tcx.emit_spanned_lint(
-            lint::builtin::OVERLAPPING_RANGE_ENDPOINTS,
-            rcx.match_lint_level,
-            pat_span,
-            errors::OverlappingRangeEndpoints { overlap: overlaps, range: pat_span },
-        );
-    }
-}