Skip to content

Commit 21a0e5d

Browse files
committed
Remove fishy condition
That condition was leftover from a refactor, and was probably not intended. In fact it can't trigger: it would require a ConstantValue of an integral type for which `try_eval_bits` fails. But since we only apply `subtract_ctors` to the output of `all_ctors`, this won't happen.
1 parent 116e46e commit 21a0e5d

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

src/librustc_mir/hair/pattern/_match.rs

+2-24
Original file line numberDiff line numberDiff line change
@@ -602,13 +602,6 @@ impl<'tcx> Constructor<'tcx> {
602602
}
603603
}
604604

605-
fn is_integral_range(&self) -> bool {
606-
match self {
607-
IntRange(_) => return true,
608-
_ => return false,
609-
};
610-
}
611-
612605
fn variant_index_for_adt<'a>(
613606
&self,
614607
cx: &MatchCheckCtxt<'a, 'tcx>,
@@ -630,12 +623,8 @@ impl<'tcx> Constructor<'tcx> {
630623
fn subtract_ctors(&self, other_ctors: &Vec<Constructor<'tcx>>) -> Vec<Constructor<'tcx>> {
631624
match self {
632625
// Those constructors can only match themselves.
633-
Single | Variant(_) => {
634-
if other_ctors.iter().any(|c| c == self) {
635-
vec![]
636-
} else {
637-
vec![self.clone()]
638-
}
626+
Single | Variant(_) | ConstantValue(..) | ConstantRange(..) => {
627+
if other_ctors.iter().any(|c| c == self) { vec![] } else { vec![self.clone()] }
639628
}
640629
&FixedLenSlice(self_len) => {
641630
let overlaps = |c: &Constructor<'_>| match *c {
@@ -732,17 +721,6 @@ impl<'tcx> Constructor<'tcx> {
732721
// Convert the ranges back into constructors
733722
remaining_ranges.into_iter().map(IntRange).collect()
734723
}
735-
ConstantRange(..) | ConstantValue(..) => {
736-
if other_ctors.iter().any(|c| {
737-
c == self
738-
// FIXME(Nadrieril): This condition looks fishy
739-
|| c.is_integral_range()
740-
}) {
741-
vec![]
742-
} else {
743-
vec![self.clone()]
744-
}
745-
}
746724
}
747725
}
748726

0 commit comments

Comments
 (0)