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.
This commit is contained in:
Nadrieril 2019-11-09 21:46:46 +00:00
parent e47d631ca0
commit d31b4c3750

View File

@ -611,13 +611,6 @@ impl<'tcx> Constructor<'tcx> {
}
}
fn is_integral_range(&self) -> bool {
match self {
IntRange(_) => return true,
_ => return false,
};
}
fn variant_index_for_adt<'a>(
&self,
cx: &MatchCheckCtxt<'a, 'tcx>,
@ -639,12 +632,8 @@ impl<'tcx> Constructor<'tcx> {
fn subtract_ctors(&self, other_ctors: &Vec<Constructor<'tcx>>) -> Vec<Constructor<'tcx>> {
match self {
// Those constructors can only match themselves.
Single | Variant(_) => {
if other_ctors.iter().any(|c| c == self) {
vec![]
} else {
vec![self.clone()]
}
Single | Variant(_) | ConstantValue(..) | ConstantRange(..) => {
if other_ctors.iter().any(|c| c == self) { vec![] } else { vec![self.clone()] }
}
&FixedLenSlice(self_len) => {
let overlaps = |c: &Constructor<'_>| match *c {
@ -741,17 +730,6 @@ impl<'tcx> Constructor<'tcx> {
// Convert the ranges back into constructors
remaining_ranges.into_iter().map(IntRange).collect()
}
ConstantRange(..) | ConstantValue(..) => {
if other_ctors.iter().any(|c| {
c == self
// FIXME(Nadrieril): This condition looks fishy
|| c.is_integral_range()
}) {
vec![]
} else {
vec![self.clone()]
}
}
// This constructor is never covered by anything else
NonExhaustive => vec![NonExhaustive],
}