Skip to content

Commit 429770a

Browse files
committed
Splitting ensures subrange comparison is all we need
1 parent 590edee commit 429770a

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,18 +186,6 @@ impl IntRange {
186186
(lo == other_hi || hi == other_lo) && !self.is_singleton() && !other.is_singleton()
187187
}
188188

189-
/// See `Constructor::is_covered_by`
190-
fn is_covered_by(&self, other: &Self) -> bool {
191-
if self.intersection(other).is_some() {
192-
// Constructor splitting should ensure that all intersections we encounter are actually
193-
// inclusions.
194-
assert!(self.is_subrange(other));
195-
true
196-
} else {
197-
false
198-
}
199-
}
200-
201189
/// Partition a range of integers into disjoint subranges. This does constructor splitting for
202190
/// integer ranges as explained at the top of the file.
203191
///
@@ -730,7 +718,7 @@ impl<'tcx> Constructor<'tcx> {
730718
(Single, Single) => true,
731719
(Variant(self_id), Variant(other_id)) => self_id == other_id,
732720

733-
(IntRange(self_range), IntRange(other_range)) => self_range.is_covered_by(other_range),
721+
(IntRange(self_range), IntRange(other_range)) => self_range.is_subrange(other_range),
734722
(F32Range(self_from, self_to, self_end), F32Range(other_from, other_to, other_end)) => {
735723
self_from.ge(other_from)
736724
&& match self_to.partial_cmp(other_to) {

0 commit comments

Comments
 (0)