Commit Graph

102414 Commits

Author SHA1 Message Date
Yuki Okushi
6e6c46c694
Rollup merge of #66456 - Centril:driver-codes, r=Mark-Simulacrum
Move `DIAGNOSTICS` usage to `rustc_driver`

Remove `rustc_interface`'s dependency on `rustc_error_codes` and centralize all usages of `DIAGNOSTICS` in `rustc_driver`. Once we remove all references to `rustc_error_codes` in all other crates but `rustc_driver`, this should allow for incremental recompilation of the compiler to be smoother when tweaking error codes. This works towards https://github.com/rust-lang/rust/issues/66210#issuecomment-551862528.

(May include traces of minor drive-by cleanup.)

r? @Mark-Simulacrum
2019-11-17 13:36:18 +09:00
Yuki Okushi
05482d03bc
Rollup merge of #66395 - jplatte:centralize-panic-docs, r=Dylan-DPC
Centralize panic macro documentation

This is just the main commit from #61511 (which got closed because the author didn't reply) cherry-picked on the current master. Building `core` and `std` on this branch in stage 1 succeeded, which I thinks means the issues from the previous PR should be gone (but let's see what CI says).
2019-11-17 13:36:16 +09:00
Yuki Okushi
842612fcc0
Rollup merge of #66381 - Centril:66340, r=petrochenkov
find_deprecation: deprecation attr may be ill-formed meta.

Fixes #66340.

r? @petrochenkov
cc @pnkfelix
2019-11-17 13:36:15 +09:00
Yuki Okushi
54998d1b3f
Rollup merge of #66344 - petrochenkov:noregattr, r=matthewjasper
rustc_plugin: Remove `Registry::register_attribute`

Legacy plugins cannot register inert attributes anymore.

The preferred replacement is to use `register_tool` ([tracking issue](https://github.com/rust-lang/rust/issues/66079)).
```rust
#![register_tool(servo)]

#[servo::must_root]
struct S;
```

The more direct replacement is `register_attribute` ([tracking issue](https://github.com/rust-lang/rust/issues/66080))
```rust
#![register_attr(must_root)]

#[must_root]
struct S;
```
, but it requires registering each attribute individually rather than registering the tool once, and is more likely to be removed rather than stabilized.
2019-11-17 13:36:13 +09:00
Yuki Okushi
b83d50d34f
Rollup merge of #66271 - petrochenkov:abism, r=Centril
syntax: Keep string literals in ABIs and `asm!` more precisely

As a result we don't lose spans when `extern` functions or blocks are passed to proc macros, and also escape all string literals consistently.
Continuation of https://github.com/rust-lang/rust/pull/60679, which did a similar thing with all literals besides those in ABIs and `asm!`.

TODO: Add tests.

Fixes https://github.com/rust-lang/rust/issues/60493
Fixes https://github.com/rust-lang/rust/issues/64561
r? @Centril
2019-11-17 13:36:12 +09:00
Yuki Okushi
d8f2526703
Rollup merge of #65739 - mqudsi:vec_split_off_docs, r=dtolnay
Improve documentation of `Vec::split_off(...)`

The previous ordering of the sentences kept switching between the return
value and the value of `self` after execution, making it hard to follow.

Additionally, as rendered in the browser, the period in "`Self`. `self`"
was difficult to make out as being a sentence separator and not one code
block.
2019-11-17 13:36:10 +09:00
bors
2cdc289cb8 Auto merge of #66394 - wesleywiser:fix_oom, r=oli-obk
Fix two OOM issues related to `ConstProp`

Fixes #66342
Fixes #66397

r? @oli-obk
2019-11-16 22:54:33 +00:00
Vadim Petrochenkov
28aec1beaa Add some more tests 2019-11-17 01:11:35 +03:00
Vadim Petrochenkov
11580ced40 Address review comments 2019-11-17 01:11:28 +03:00
Mahmoud Al-Qudsi
a36c3f6f68 Revise the text of vec::split_off() per review in #65739
Remove the incorrect usage of "copy" as the trait is not called.
2019-11-16 14:15:07 -06:00
Mahmoud Al-Qudsi
8c7530ade8 Improve documentation of Vec::split_off(...)
The previous ordering of the sentences kept switching between the return
value and the value of `self` after execution, making it hard to follow.

Additionally, as rendered in the browser, the period in "`Self`. `self`"
was difficult to make out as being a sentence separator and not one code
block.
2019-11-16 14:15:07 -06:00
bors
5c5b8afd80 Auto merge of #64694 - petrochenkov:reshelp, r=matthewjasper
Fully integrate derive helpers into name resolution

```rust
#[derive(Foo)]
#[foo_helper] // already goes through name resolution
struct S {
    #[foo_helper] // goes through name resolution after this PR
    field: u8
}
```
How name resolution normally works:
- We have an identifier we need to resolve, take its location (in some sense) and look what names are in scope in that location.

How derive helper attributes are "resolved" (before this PR):
- After resolving the derive `Foo` we visit the derive's input (`struct S { ... } `) as a piece of AST and mark attributes textually matching one of the derive's helper attributes (`foo_helper`) as "known", so they never go through name resolution.

This PR changes the rules for derive helpers, so they are not proactively marked as known (which is a big hack ignoring any ambiguities or hygiene), but go through regular name resolution instead.
This change was previously blocked by attributes not being resolved in some positions at all (fixed in https://github.com/rust-lang/rust/pull/63468).

"Where exactly are derive helpers in scope?" is an interesting question, and I need some feedback from proc macro authors to answer it, see the post below (https://github.com/rust-lang/rust/pull/64694#issuecomment-533925160).
2019-11-16 19:50:48 +00:00
Vadim Petrochenkov
a699f17483 parse: Use string literal parsing in the asm macro 2019-11-16 21:21:37 +03:00
Vadim Petrochenkov
b85a3da421 parse: Support parsing optional literals
Revert weird renaming of the former `LitError::report`
2019-11-16 21:21:37 +03:00
Vadim Petrochenkov
00bc449602 ast: Keep string literals in ABIs precisely 2019-11-16 21:21:37 +03:00
Vadim Petrochenkov
266f547127 ast: Keep extern qualifiers in functions more precisely 2019-11-16 21:21:37 +03:00
Wesley Wiser
2dea8af20c Only run tests on x86_64 2019-11-16 13:01:12 -05:00
Vadim Petrochenkov
8575743793 rustc_plugin: Remove Registry::register_attribute 2019-11-16 18:50:23 +03:00
Vadim Petrochenkov
8668c1a190 Add some more tests 2019-11-16 18:31:55 +03:00
Vadim Petrochenkov
808522894b expand: Stop marking derive helper attributes as known
Pass them through name resolution instead
2019-11-16 18:31:47 +03:00
Vadim Petrochenkov
a3126a5013 resolve: Introduce a new scope for derive helpers 2019-11-16 18:20:57 +03:00
Vadim Petrochenkov
c064630e77 resolve: Scope::DeriveHelpers -> Scope::DeriveHelpersCompat
These helpers are resolved before their respective derives through a kind of look ahead into future expansions.
Some of these will migrate to proper resolution, others will be deprecated.

```
#[trait_helper] // Deprecate
#[derive(Trait)]
#[trait_helper] // Migrate to proper resolution
```
2019-11-16 18:20:39 +03: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 (a533ae9c5a/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
Mazdak Farrokhzad
8444e1628c move DIAGNOSTICS usage to rustc_driver 2019-11-16 02:32:33 +01: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
Wesley Wiser
9e1b210c6a Respond to review feedback 2019-11-15 18:18:50 -05:00
Wesley Wiser
3732b7acf1 [ConstProp] Avoid OOM crashes by not evaluating large Places
Fixes #66397
2019-11-15 18:18:50 -05:00
Wesley Wiser
d389f64cdb Fix spurious CI filures due to OOM
Fixes #66342
2019-11-15 18:18:50 -05: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