Skip to content

Commit

Permalink
Fix range splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Aug 16, 2018
1 parent a20cb10 commit 7f72030
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/librustc_mir/hair/pattern/_match.rs
Expand Up @@ -725,8 +725,8 @@ fn ranges_subtract_pattern<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
} else {
// The pattern intersects the middle of the subrange,
// so we create two ranges either side of the intersection.)
remaining_ranges.push((subrange_lo, pat_interval.lo));
remaining_ranges.push((pat_interval.hi, subrange_hi));
remaining_ranges.push((subrange_lo, pat_interval.lo - 1));
remaining_ranges.push((pat_interval.hi + 1, subrange_hi));
}
}
// Convert the remaining ranges from pairs to inclusive `ConstantRange`s.
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/exhaustive_integer_patterns.stderr
Expand Up @@ -16,23 +16,23 @@ error[E0004]: non-exhaustive patterns: `128u8...255u8` not covered
LL | match x { //~ ERROR non-exhaustive patterns: `128u8...255u8` not covered
| ^ pattern `128u8...255u8` not covered

error[E0004]: non-exhaustive patterns: `11u8...20u8`, `30u8...35u8`, `35u8...70u8` and 1 more not covered
error[E0004]: non-exhaustive patterns: `11u8...19u8`, `31u8...34u8`, `36u8...69u8` and 1 more not covered
--> $DIR/exhaustive_integer_patterns.rs:42:11
|
LL | match x { //~ ERROR non-exhaustive patterns
| ^ patterns `11u8...20u8`, `30u8...35u8`, `35u8...70u8` and 1 more not covered
| ^ patterns `11u8...19u8`, `31u8...34u8`, `36u8...69u8` and 1 more not covered

error: unreachable pattern
--> $DIR/exhaustive_integer_patterns.rs:53:9
|
LL | -2..=20 => {} //~ ERROR unreachable pattern
| ^^^^^^^

error[E0004]: non-exhaustive patterns: `-128i8...-5i8`, `120i8...121i8` and `121i8...127i8` not covered
error[E0004]: non-exhaustive patterns: `-128i8...-6i8` and `122i8...127i8` not covered
--> $DIR/exhaustive_integer_patterns.rs:50:11
|
LL | match x { //~ ERROR non-exhaustive patterns
| ^ patterns `-128i8...-5i8`, `120i8...121i8` and `121i8...127i8` not covered
| ^ patterns `-128i8...-6i8` and `122i8...127i8` not covered

error: aborting due to 5 previous errors

Expand Down

0 comments on commit 7f72030

Please sign in to comment.