Skip to content

Commit

Permalink
Auto merge of #66326 - Nadrieril:refactor-intrange, r=varkor
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 15, 2019
2 parents 1bd30ce + 694a511 commit 82161cd
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 347 deletions.
Loading

0 comments on commit 82161cd

Please sign in to comment.