Commit Graph

106591 Commits

Author SHA1 Message Date
Camille GILLOT
98b46f7796 Move weak_lang_items.rs to librustc_passes. 2020-02-11 23:12:16 +01:00
Camille GILLOT
4ecba94dcb Move weak lang items to librustc_lang_items. 2020-02-11 23:11:29 +01:00
Camille GILLOT
c04195da9f Move get_lang_items query in librustc_passes. 2020-02-11 23:10:47 +01:00
Camille GILLOT
ff369236a3 Move lang_items definitions to librustc_lang_items. 2020-02-11 23:09:22 +01:00
Camille GILLOT
a056817aae Move hir::check_attr::Target to librustc_lang_items. 2020-02-11 23:07:54 +01:00
Camille GILLOT
60aaf90834 Move macro enum_from_u32 to rustc_data_structures. 2020-02-11 23:03:53 +01:00
bors
3f32e3001e Auto merge of #69062 - Dylan-DPC:rollup-7wpjpqu, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #66498 (Remove unused feature gates)
 - #68816 (Tweak borrow error on `FnMut` when `Fn` is expected)
 - #68824 (Enable Control Flow Guard in rustbuild)
 - #69022 (traits: preallocate 2 Vecs of known initial size)
 - #69031 (Use `dyn Trait` more in tests)
 - #69044 (Don't run coherence twice for future-compat lints)
 - #69047 (Don't rustfmt check the vendor directory.)
 - #69055 (Clean up E0307 explanation)

Failed merges:

r? @ghost
2020-02-11 17:45:49 +00:00
Dylan DPC
82a366ad86
Rollup merge of #69055 - GuillaumeGomez:clean-up-e0307, r=Dylan-DPC
Clean up E0307 explanation

r? @Dylan-DPC
2020-02-11 16:37:06 +01:00
Dylan DPC
c88b3494b0
Rollup merge of #69047 - ehuss:rustfmt-vendor, r=Centril
Don't rustfmt check the vendor directory.

I need to be able to run `x.py tidy` to do license checks (which requires vendored dependencies).  However, when vendoring is enabled, it wants to rustfmt check the entire vendor directory, which doesn't work.
2020-02-11 16:37:04 +01:00
Dylan DPC
0ba5e8a88f
Rollup merge of #69044 - jonas-schievink:dont-run-coherence-twice, r=davidtwco
Don't run coherence twice for future-compat lints

This fixes the regression introduced by https://github.com/rust-lang/rust/pull/65232 (which I mentioned in https://github.com/rust-lang/rust/pull/65232#issuecomment-583739037).

Old algorithm:
* Run coherence with all future-incompatible checks off, reporting errors on any overlap.
* If there's no overlap (common case), run it *again*, with the future-incompatible checks on. Report warnings for any overlap found.

New algorithm:
* Run coherence with all additional future-incompatible checks *on*, which means that we'll find *all* potentially overlapping impls immediately.
* If this found overlap, run coherence again, with the future-incompatible checks off. If that *still* gives an error, we report it. If not, it ought to be a warning.

This reduces time spent in coherence checking for the nrf52810-pac by roughly 50% relative to current master.
2020-02-11 16:37:02 +01:00
Dylan DPC
dc98cb09c0
Rollup merge of #69031 - Centril:dyntest, r=eddyb
Use `dyn Trait` more in tests

Here are some tests using the old trait object type syntax which are not testing the syntax itself.

This has been extracted from https://github.com/rust-lang/rust/pull/66364.
2020-02-11 16:37:01 +01:00
Dylan DPC
d8b4abc4ad
Rollup merge of #69022 - ljedrz:traits_tweak_vecs, r=petrochenkov
traits: preallocate 2 Vecs of known initial size

The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from.

In `WfPredicates::normalize` the change from a functional style improves readability and should be perf-friendly, too.
2020-02-11 16:36:59 +01:00
Dylan DPC
c8c2b2bc54
Rollup merge of #68824 - ajpaverd:cfguard-rustbuild, r=Mark-Simulacrum
Enable Control Flow Guard in rustbuild

Now that Rust supports Control Flow Guard (#68180), add a config.toml option to build the standard library with CFG enabled.

r? @nagisa
2020-02-11 16:36:57 +01:00
Dylan DPC
b6024c4766
Rollup merge of #68816 - estebank:fn-mut-closure, r=varkor
Tweak borrow error on `FnMut` when `Fn` is expected

Fix #31701, fix #66097.
2020-02-11 16:36:55 +01:00
Dylan DPC
ec0cfd1d01
Rollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPC
Remove unused feature gates

I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
2020-02-11 16:36:54 +01:00
bors
95e0a2c50d Auto merge of #68725 - jumbatm:invert-control-in-struct_lint_level, r=Centril
Invert control in struct_lint_level.

Closes #67927

Changes the `struct_lint*` methods to take a  `decorate` function instead of a message string. This decorate function is also responsible for eventually stashing, emitting or cancelling the diagnostic. If the lint was allowed after all, the decorate function is not run at all, saving us from spending time formatting messages (and potentially other expensive work) for lints that don't end up being emitted.

r? @Centril
2020-02-11 14:45:00 +00:00
Guillaume Gomez
e20108f9c4 Clean up E0307 explanation 2020-02-11 11:39:41 +01:00
jumbatm
b959da2f4c Fix stage2 test failures from call to span_lint.
span_lint was removed. Callers should use the `lint` method now, and
call `set_span` within the closure passed to this method.
2020-02-11 19:50:26 +10:00
jumbatm
e450996193 Avoid allocs in a few places.
- AnonymousParameters::check_trait_item
- TypeAliasBounds::check_item
- NonSnakeCase::check_snake_case
2020-02-11 19:50:26 +10:00
jumbatm
284982df60 Address review nitpicks. 2020-02-11 19:50:26 +10:00
jumbatm
0b2436f3a4 Move more into decorate functions. 2020-02-11 19:50:26 +10:00
jumbatm
aa3c458c06 Run RustFmt 2020-02-11 19:50:21 +10:00
jumbatm
2f0430a163 Make cx.span_lint methods lazy
- Make report_unsafe take decorate function
- Remove span_lint, replacing calls with struct_span_lint, as caller is
now responsible for emitting.
- Remove lookup_and_emit, replacing with just lookup which takes a
decorate function.
- Remove span_lint_note, span_lint_help.  These methods aren't easily
made lazy as standalone methods, private, and unused. If this
functionality is needed, to be lazy, they can easily be made into
Fn(&mut DiagnosticBuilder) that are meant to be called _within_ the
decorate function.
- Rename lookup_and_emit_with_diagnostics to lookup_with_diagnostics to
better reflect the fact that it doesn't emit for you.
2020-02-11 19:49:01 +10:00
jumbatm
b2e78faa15 Move more work into decorate functions. 2020-02-11 19:49:01 +10:00
jumbatm
d246385122 Run RustFmt 2020-02-11 19:49:01 +10:00
jumbatm
0634a50073 Also check for "use fully-qualified syntax". 2020-02-11 19:47:40 +10:00
jumbatm
0df1ca3033 Box decorate to avoid code bloat. 2020-02-11 19:47:40 +10:00
jumbatm
7c58ffe874 Invert control in struct_lint_level.
Caller now passes in a `decorate` function, which is only run if the
lint is allowed.
2020-02-11 19:47:40 +10:00
bors
b6690a8c35 Auto merge of #68961 - eddyb:dbg-stack-dunk, r=nagisa
rustc_codegen_ssa: only "spill" SSA-like values to the stack for debuginfo.

This is an implementation of the idea described in https://github.com/rust-lang/rust/issues/68817#issuecomment-583719182.

In short, instead of debuginfo forcing otherwise-SSA-like MIR locals into `alloca`s, and requiring a `load` for each use (or two, for scalar pairs), the `alloca` is now *only* used for attaching debuginfo with `llvm.dbg.declare`: the `OperandRef` is stored to the `alloca`, but *never loaded* from it.

Outside of `debug_introduce_local`, nothing cares about the debuginfo-only `alloca`, and instead works with `OperandRef` the same as MIR locals without debuginfo before this PR.

This should have some of the benefits of `llvm.dbg.value`, while working today.

cc @nagisa @nikomatsakis
2020-02-11 07:36:59 +00:00
Eric Huss
6575abcb36 Don't rustfmt the vendor directory. 2020-02-10 19:08:24 -08:00
bors
dc4242d905 Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPC
Make issue references consistent

Fixes https://github.com/rust-lang/rust/issues/62976

cc https://github.com/rust-lang/rust/pull/63008

r? @varkor because you reviewed the original pr
2020-02-11 02:00:27 +00:00
Jonas Schievink
f66793757f Don't run coherence twice for future-compat lints 2020-02-11 00:17:47 +01:00
bors
0f0cdf6acd Auto merge of #69030 - Dylan-DPC:rollup-t9uk7vc, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #68897 (clean up E0275 explanation)
 - #68908 (Add long error code explanation message for E0637 )
 - #68932 (self-profile: Support arguments for generic_activities.)
 - #68986 (Make ASCII ctype functions unstably const )
 - #69007 (Clean up E0283 explanation)
 - #69014 (change an instance of span_bug() to struct_span_err() to avoid ICE)

Failed merges:

r? @ghost
2020-02-10 22:46:29 +00:00
Andrew Paverd
87df124ba7 Enable Control Flow Guard in rustbuild 2020-02-10 19:26:25 +00:00
Mazdak Farrokhzad
75afd0b0cf use dyn Trait more in tests 2020-02-10 17:42:09 +01:00
Dylan DPC
119bc976db
Rollup merge of #69014 - dwrensha:fix-68890, r=Centril
change an instance of span_bug() to struct_span_err() to avoid ICE

After #67148, the `span_bug()` in `parse_ty_tuple_or_parens()` is reachable because `parse_paren_comma_seq()` can return an `Ok()` even in cases where it encounters an error.
This pull request prevents an ICE in such cases by replacing the `span_bug()` with `struct_span_error()`.

Fixes #68890.
2020-02-10 17:29:03 +01:00
Dylan DPC
db08784964
Rollup merge of #69007 - GuillaumeGomez:clean-up-e0283, r=Dylan-DPC
Clean up E0283 explanation

r? @Dylan-DPC
2020-02-10 17:29:01 +01:00
Dylan DPC
6e1b75b7e1
Rollup merge of #68986 - ecstatic-morse:const-ascii-ctype, r=Centril
Make ASCII ctype functions unstably const

Makes the following inherent methods on `u8` and `char` unstable `const fn`:

 * `is_ascii_alphabetic`
 * `is_ascii_uppercase`
 * `is_ascii_lowercase`
 * `is_ascii_alphanumeric`
 * `is_ascii_digit`
 * `is_ascii_hexdigit`
 * `is_ascii_punctuation`
 * `is_ascii_graphic`
 * `is_ascii_whitespace`
 * `is_ascii_control`

cc #68983
2020-02-10 17:28:59 +01:00
Dylan DPC
24260e5bae
Rollup merge of #68932 - michaelwoerister:self-profile-generic-activity-args, r=wesleywiser
self-profile: Support arguments for generic_activities.

This PR adds support for recording arguments of "generic activities". The most notable use case is LLVM module names, which should be very interesting for `crox` profiles. In the future it might be interesting to add more fine-grained events for pre-query passes like macro expansion.

I tried to judiciously de-duplicate existing self-profile events with `extra_verbose_generic_activity`, now that the latter also generates self-profile events.

r? @wesleywiser
2020-02-10 17:28:57 +01:00
Dylan DPC
531f235134
Rollup merge of #68908 - jwhite927:E0637, r=Dylan-DPC
Add long error code explanation message for E0637

Reference issue [#61137](https://github.com/rust-lang/rust/issues/61137)
To incorporate a long error description for E0637, I have made the necessary modification to error_codes.rs and added error_codes/E0637.md, and blessed the relevant .stderror files. ~~, however when I build rustc stage 1, I am unable to make `$ rustc --explain E0637` work even though rustc appears to be able to call up the long error explanations for other errors. I wanted to guarantee this would work before moving on the blessing the various ui tests that have been affected. @GuillaumeGomez Do you know the most likely reason(s) why this would be the case?~~
Update: `$ rustc --explain E0637` works now.
2020-02-10 17:28:56 +01:00
Dylan DPC
1e26a1c4d1
Rollup merge of #68897 - GuillaumeGomez:clean-up-e0275, r=Dylan-DPC
clean up E0275 explanation

r? @Dylan-DPC
2020-02-10 17:28:54 +01:00
bors
e6ec0d125e Auto merge of #68835 - CAD97:sound-range-inclusive, r=Mark-Simulacrum
Remove problematic specialization from RangeInclusive

Fixes #67194 using the approach [outlined by Mark-Simulacrum](https://github.com/rust-lang/rust/issues/67194#issuecomment-581669549).

> I believe the property we want is that if `PartialEq(&self, &other) == true`, then `self.next() == other.next()`. It is true that this is satisfied by removing the specialization and always doing `is_empty.unwrap_or_default()`; the "wrong" behavior there arises from calling `next()` having an effect on initially empty ranges, as we should be in `is_empty = true` but are not (yet) there. It might be possible to detect that the current state is always empty (i.e., `start > end`) and then not fill in the empty slot. I think this might solve the problem without regressing tests; however, this could have performance implications.

> That approach essentially states that we only use the `is_empty` slot for cases where `start <= end`. That means that `Idx: !Step` and `start > end` would both behave the same, and correctly -- we do not need the boolean if we're not ever going to emit any values from the iterator.

This is implemented here by replacing the `is_empty: Option<bool>` slot with an `exhausted: bool` slot. This flag is

- `false` upon construction,
- `false` when iteration has not yielded an element -- importantly, this means it is always `false` for an iterator empty by construction,
- `false` when iteration has yielded an element and the iterator is not exhausted, and
- only `true` when iteration has been used to exhaust the iterator.

For completeness, this also adds a note to the `Debug` representation to note when the range is exhausted.
2020-02-10 15:24:59 +00:00
Michael Woerister
81dccb1a5c self-profile: Support arguments for generic_activities. 2020-02-10 15:46:41 +01:00
ljedrz
b8893df8d3 preallocate 2 Vecs in traits; tweak WfPredicates::normalize 2020-02-10 15:22:09 +01:00
Guillaume Gomez
37e7b46177 clean up E0275 explanation 2020-02-10 13:25:48 +01:00
Guillaume Gomez
ded629289a Clean up E0283 explanation 2020-02-10 13:23:52 +01:00
bors
4d1241f515 Auto merge of #69012 - Dylan-DPC:rollup-13qn0fq, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #68694 (Reduce the number of `RefCell`s in `InferCtxt`.)
 - #68966 (Improve performance of coherence checks)
 - #68976 (Make `num::NonZeroX::new` an unstable `const fn`)
 - #68992 (Correctly parse `mut a @ b`)
 - #69005 (Small graphviz improvements for the new dataflow framework)
 - #69006 (parser: Keep current and previous tokens precisely)

Failed merges:

r? @ghost
2020-02-10 10:47:39 +00:00
David Renshaw
371060b598 [parser] change an instance of span_bug() to struct_span_err() to avoid ICE 2020-02-09 23:02:02 -05:00
Dylan DPC
18c6d39b55
Rollup merge of #69006 - petrochenkov:prevspan2, r=Centril
parser: Keep current and previous tokens precisely

...including their unnormalized forms.
Add more documentation for them.

Hopefully, this will help to eliminate footguns like https://github.com/rust-lang/rust/pull/68728#discussion_r373787486.

I'll try to address the FIXMEs in separate PRs during the next week.

r? @Centril
2020-02-10 01:54:23 +01:00
Dylan DPC
a8d4ccf907
Rollup merge of #69005 - ecstatic-morse:unified-dataflow-graphviz, r=wesleywiser
Small graphviz improvements for the new dataflow framework

Split out from #68241. This prints the correct effect diff for each line (the before-effect and the after-effect) and makes marginal improvements to the graphviz output for the new dataflow framework including using monospaced font and better line breaking. This will only be useful when #68241 is merged and the graphviz output changes from this:

![image](https://user-images.githubusercontent.com/29463364/74107776-5e3c3300-4b28-11ea-9d33-4862228b5e87.png)

to this:

![image](https://user-images.githubusercontent.com/29463364/74107751-20d7a580-4b28-11ea-99ca-24f749386601.png)

r? @wesleywiser
2020-02-10 01:54:21 +01:00