diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2023-10-03 16:21:40 +0200 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2023-10-03 16:33:23 +0200 |
| commit | 429770a48eb7dcb11831d4670a25a01c698f704c (patch) | |
| tree | 69a91699cdd931f51a225c25e87f895fa4d5a6ee | |
| parent | 590edee3209906b3906f09bad029586b0a15e29f (diff) | |
| download | rust-429770a48eb7dcb11831d4670a25a01c698f704c.tar.gz rust-429770a48eb7dcb11831d4670a25a01c698f704c.zip | |
Splitting ensures subrange comparison is all we need
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs index 6755e665bba..b4bc4569878 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs @@ -186,18 +186,6 @@ impl IntRange { (lo == other_hi || hi == other_lo) && !self.is_singleton() && !other.is_singleton() } - /// See `Constructor::is_covered_by` - fn is_covered_by(&self, other: &Self) -> bool { - if self.intersection(other).is_some() { - // Constructor splitting should ensure that all intersections we encounter are actually - // inclusions. - assert!(self.is_subrange(other)); - true - } else { - false - } - } - /// Partition a range of integers into disjoint subranges. This does constructor splitting for /// integer ranges as explained at the top of the file. /// @@ -730,7 +718,7 @@ impl<'tcx> Constructor<'tcx> { (Single, Single) => true, (Variant(self_id), Variant(other_id)) => self_id == other_id, - (IntRange(self_range), IntRange(other_range)) => self_range.is_covered_by(other_range), + (IntRange(self_range), IntRange(other_range)) => self_range.is_subrange(other_range), (F32Range(self_from, self_to, self_end), F32Range(other_from, other_to, other_end)) => { self_from.ge(other_from) && match self_to.partial_cmp(other_to) { |
