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](https://github.com/rust-lang/rust/pull/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 ?
libpanic_unwind for Miri: make sure we have the SEH lang items when needed
r? @oli-obk @alexcrichton This is required to fix the Miri toolstate. Turns out rustc complains when doing codegen for MSVC and these lang items do not exist. For now `cfg(miri)` needs to still be able to codegen (we [plan to change that](https://github.com/rust-lang/miri/pull/1048#issuecomment-554108470) but that's a larger project requiring improvements to xargo and maybe also cargo; that should not block fixing the toolstate). Yes, this is a hack, but it is inside `cfg(miri)` so I hope this is okay.
Cc @Aaron1011
Move the JSON error emitter to librustc_errors
This is done both as a cleanup (it makes little sense for this emitter to be in libsyntax), but also as part of broader work to decouple Session from librustc itself.
Along the way, this also moves SourceMap to syntax_pos, which is also nice for the above reasons, as well as allowing dropping the SourceMapper trait from code. This had the unfortunate side-effect of moving `FatalError` to rustc_data_structures (it's needed in syntax_pos, due to SourceMap, but putting it there feels somehow worse).
Add --force-run-in-process unstable option to libtest
When running tests with `-Zpanic_abort_tests`, it's sometimes desirable to fall back to the old behavior of only running tests in-process. This comes in handy if the system process launcher is unavailable, or the test code somehow expects all tests to be run in the same process.
For example, in Fuchsia we have unit tests that actually test the process launcher itself, in which case we can't use the process launcher to run the tests :).
r? @alexcrichton
cc @cramertj,@petrhosek
Add more tests for fixed ICEs
Closes#36122 (fixed in 1.20.0)
Closes#58094 (fixed in #66054)
Also, fix mistaken test case, from #30904 to #30906 (cc @eddyb)
r? @Centril
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.
SourceMap is now in the root of all rustc-specific crates, syntax_pos,
so there's no need for the trait object to decouple the dependencies
between librustc_errors and libsyntax as was needed previously.