diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2019-11-09 21:46:46 +0000 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2019-11-15 16:55:34 +0000 |
| commit | d31b4c37506ee7a36f3edeb63deba6de22745ce3 (patch) | |
| tree | 53a43d3763156309c9bfd01dc63c575bf51ef79a | |
| parent | e47d631ca0eebb2e5b7f0d40230f78ba7b92592e (diff) | |
| download | rust-d31b4c37506ee7a36f3edeb63deba6de22745ce3.tar.gz rust-d31b4c37506ee7a36f3edeb63deba6de22745ce3.zip | |
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.
| -rw-r--r-- | src/librustc_mir/hair/pattern/_match.rs | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index e3b0c5a5c69..be268738da8 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -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], } |
