Skip to content

Commit

Permalink
Auto merge of #66326 - Nadrieril:refactor-intrange, r=<try>
Browse files Browse the repository at this point in the history
Refactor integer range handling in the usefulness algorithm

Integer range handling had accumulated a lot of debt. This cleans up a lot of it.

In particular this:
- removes unnecessary conversions between `Const` and `u128`, and between `Constructor` and `IntRange`
- clearly distinguishes between on the one hand ranges of integers that may or may not be matched exhaustively, and on the other hand ranges of non-integers that are never matched exhaustively and are compared using Const-based shenanigans
- cleans up some overly complicated code paths
- generally tries to be more idiomatic.

As a nice side-effect, I measured a 10% perf increase on `unicode_normalization`.

There's one thing that I feel remains to clean up: the [overlapping range check](#64007), which is currently quite ad-hoc. But that is intricate enough that I'm leaving it out of this PR.

There's also one little thing I'm not sure I understand: can `try_eval_bits` fail for an integer constant value in that code ? What would that mean, and how do I construct a test case for this possibility ?
  • Loading branch information
bors committed Nov 13, 2019
2 parents 374ad1b + 0e3ec65 commit 9fabb30
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 334 deletions.
Loading

0 comments on commit 9fabb30

Please sign in to comment.