Commit Graph

102391 Commits

Author SHA1 Message Date
Esteban Küber 7a2f3ee73f Account for rustc_on_unimplemented 2019-11-16 13:23:19 -08:00
Esteban Küber 0f7f2346a6 Remove unnecessary note 2019-11-16 13:23:19 -08:00
Esteban Küber 970503b2e1 Modify primary label message to be inline with error message 2019-11-16 13:23:19 -08:00
Esteban Küber f57413b717 Suggest borrowing when it would satisfy an unmet trait bound
When there are multiple implementors for the same trait that is present
in an unmet binding, modify the E0277 error to refer to the parent
obligation and verify whether borrowing the argument being passed in
would satisfy the unmet bound. If it would, suggest it.
2019-11-16 13:23:19 -08:00
Esteban Küber 405a3dd91c Tweak code formatting 2019-11-16 13:23:19 -08:00
bors 5f00849dc4 Auto merge of #66333 - mark-i-m:fix-rustc-guide-1, r=ehuss
Fix rustc guide again

r? @ehuss

Sorry, links change fast in this world...
2019-11-16 14:27:53 +00:00
bors 9b0214d9c5 Auto merge of #66255 - ehuss:update-cc, r=alexcrichton
Update cc, git2, num_cpus.

This updates the `cc` crate, bringing in better parallel building support. Also updates `git2` which enables the parallel feature. (Note: I don't expect it will have a significant impact on build time, but seems good to update anyways.)

The main thorn is that `cc` gained knowledge about RISC-V architectures (https://github.com/alexcrichton/cc-rs/pull/428, https://github.com/alexcrichton/cc-rs/pull/429, https://github.com/alexcrichton/cc-rs/pull/430), but the builders on CI do not have the riscv C compiler installed. This means that bootstraps' cc detection was finding a C compiler that isn't installed, and fails.

The solution here is to override the cc detection to `false`. The C compiler isn't actually used on riscv platforms. AFAIK, the only location would be compiler_builtins, and it currently forces C support off (https://github.com/rust-lang/compiler-builtins/blob/a533ae9c5aa325db209659679535fe1f186eae81/build.rs#L49-L55).

Other possible solutions:
- Add the override in cc_detect for riscv (or any "no-C" platform like wasm32 and nvptx)
- Install and use the appropriate c compiler. I tried this the `g++-riscv64-linux-gnu` package, but it failed missing some header file.

Closes #66232
2019-11-16 07:26:57 +00:00
bors 1d8b6ce89e Auto merge of #66453 - Centril:rollup-w1ohzxs, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #66350 (protect creation of destructors by a mutex)
 - #66407 (Add more tests for fixed ICEs)
 - #66415 (Add --force-run-in-process unstable option to libtest)
 - #66427 (Move the JSON error emitter to librustc_errors)
 - #66441 (libpanic_unwind for Miri: make sure we have the SEH lang items when needed)

Failed merges:

r? @ghost
2019-11-16 02:40:52 +00:00
bors 82161cda33 Auto merge of #66326 - Nadrieril:refactor-intrange, r=varkor
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 ?
2019-11-15 23:28:50 +00:00
Mazdak Farrokhzad ae9a62633a Rollup merge of #66441 - RalfJung:seh, r=oli-obk
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
2019-11-15 18:02:04 +01:00
Mazdak Farrokhzad ae0c8b5f09 Rollup merge of #66427 - Mark-Simulacrum:errors-json, r=Centril
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).
2019-11-15 18:02:02 +01:00
Mazdak Farrokhzad 4e6e1eccf1 Rollup merge of #66415 - tmandry:force-test-in-process, r=alexcrichton
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
2019-11-15 18:02:01 +01:00
Mazdak Farrokhzad e3c78d549e Rollup merge of #66407 - JohnTitor:add-ice-tests, r=Centril
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
2019-11-15 18:01:59 +01:00
Mazdak Farrokhzad 6e5a4c1385 Rollup merge of #66350 - hermitcore:hermit, r=rkruppe
protect creation of destructors by a mutex

- add on HermitCore an additional lock to protect static data
2019-11-15 18:01:58 +01:00
Nadrieril 694a511df5 Apply suggestions from code review 2019-11-15 17:00:38 +00:00
Nadrieril cde9808eaa Add regression test 2019-11-15 16:55:38 +00:00
Nadrieril addd8a9003 Apply suggestions from code review 2019-11-15 16:55:38 +00:00
Nadrieril b679e77f04 Factor out IntRange::is_subrange 2019-11-15 16:55:38 +00:00
Nadrieril Feneanar 9165dd056b Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-15 16:55:37 +00:00
Nadrieril c38aad4f4b Add test for failing try_eval_bits 2019-11-15 16:55:37 +00:00
Nadrieril d31b4c3750 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.
2019-11-15 16:55:34 +00:00
Nadrieril e47d631ca0 Malformed range patterns can't happen thanks to E0030 2019-11-15 16:49:42 +00:00
Nadrieril 3e5aadc350 Remove unnecessary data from ConstantValue/ConstantRange 2019-11-15 16:49:41 +00:00
Nadrieril f674f89e93 Store Const directly in ConstantRange 2019-11-15 16:45:55 +00:00
Nadrieril 0192124202 Make should_treat_range_exhaustively a method 2019-11-15 16:44:34 +00:00
Nadrieril d1642f1eb5 Inline now-trivial IntRange::from_ctor 2019-11-15 16:44:33 +00:00
Nadrieril aadd5e5263 Factor out getting the boundaries of an IntRange 2019-11-15 16:42:10 +00:00
Nadrieril 84784dd68e Eagerly convert ranges to IntRange
That way no `ConstantRange` or `ConstantValue` ever needs to be
converted to `IntRange`.
2019-11-15 16:42:10 +00:00
Nadrieril 6b8bfefa00 Add IntRange::to_pat and use it instead of custom display() 2019-11-15 16:42:08 +00:00
Yuki Okushi 614abe48b0 Fix nll test 2019-11-16 01:40:59 +09:00
Nadrieril 4232816be9 formatting 2019-11-15 16:39:56 +00:00
Nadrieril f93a70063c Introduce IntRange constructor 2019-11-15 16:39:31 +00:00
Nadrieril 1909e3f2bf Constructor::display was only needed for displaying IntRange
I'm planning to stop using `ConstantRange`/`ConstantValue` for integral
types, so going through `Constructor` will soon not be relevant.
2019-11-15 16:14:34 +00:00
Nadrieril 75a50886aa Avoid converting through Constructor when subtracting ranges 2019-11-15 16:14:34 +00:00
Nadrieril c6c862574d Special-case subtracting from a range if that range is not an IntRange 2019-11-15 16:14:34 +00:00
Nadrieril 6de7afdf95 Prefer IntRange::into_ctor to range_to_ctor 2019-11-15 16:14:34 +00:00
Nadrieril 0a186103ae Move range exhaustiveness check to IntRange::intersection
Only IntRange should need to worry about range exhaustiveness really.
2019-11-15 16:14:34 +00:00
Nadrieril 81db2ee902 Special-case range inclusion when the range is integral but non-exhaustive 2019-11-15 16:14:34 +00:00
Nadrieril f3752ee5d5 Cleanup constructor_covered_by_range 2019-11-15 16:14:34 +00:00
Nadrieril 8c1835dc6e IntRange::from_pat is redundant with pat_constructors 2019-11-15 16:14:34 +00:00
Nadrieril 34ad52e84f pat_constructor does not need pcx anymore 2019-11-15 16:14:34 +00:00
Nadrieril 3531c52bfe Factor out range construction in all_constructors 2019-11-15 16:14:32 +00:00
Nadrieril 8f7ba7a058 Clarify conditions for exhaustive integer range matching 2019-11-15 16:01:03 +00:00
Nadrieril c75685bef6 Note link between apply/specialize/arity functions 2019-11-15 15:38:31 +00:00
Ralf Jung 065e1b8d8a more comment 2019-11-15 15:57:01 +01:00
Yuki Okushi 09f0ee51c9 Apply suggestion from Centril
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-15 23:54:52 +09:00
Yuki Okushi 564c78a698 Fix test case and issue number 2019-11-15 23:54:52 +09:00
Yuki Okushi 74329bf619 Add test for issue-58094 2019-11-15 23:54:52 +09:00
Yuki Okushi 4e621a8b0c Add test for issue-36122 2019-11-15 23:54:52 +09:00
Tyler Mandry d252ba35d4 Improve error message for tests with panic=abort 2019-11-15 05:52:06 -08:00