Commit graph

135602 commits

Author SHA1 Message Date
Guillaume Gomez
e116732b4b
Rollup merge of #80225 - pierwill:patch-11, r=lcnr
Add module-level docs to rustc_middle::ty

I thought it would be nice to point out `Ty` and `TyCtxt` on the module page, and link out to the [rustc-dev-guide chapter](https://rustc-dev-guide.rust-lang.org/ty.html).
2020-12-23 00:13:41 +01:00
Guillaume Gomez
f9f8446130
Rollup merge of #80223 - pierwill:patch-10, r=lcnr
docs: Fix outdated crate reference
2020-12-23 00:13:40 +01:00
Guillaume Gomez
9446d43626
Rollup merge of #80222 - GreenRecycleBin:daniel/fix-rustc-std-workspace-core-documentation, r=jyn514
Fix rustc-std-workspace-core documentation

r? ```@steveklabnik```
2020-12-23 00:13:38 +01:00
Guillaume Gomez
536754f92c
Rollup merge of #80219 - camelid:library_tracking_issue-labels, r=m-ou-se
Fix labels for 'Library Tracking Issue' template

Each label needs to be separated by a comma (see the ICE issue template
for an example of correct usage).

r? `````@m-ou-se`````
2020-12-23 00:13:36 +01:00
Guillaume Gomez
8a35d3a08e
Rollup merge of #80204 - pierwill:pierwill-rustcmiddle-ondisk, r=varkor
docs: Edit rustc_middle::ty::query::on_disk_cache

Expand abbreviations for "incremental compliation".

Also added the word "to" to the description of CacheEncoder.
2020-12-23 00:13:34 +01:00
Guillaume Gomez
f84ec97485
Rollup merge of #80203 - pierwill:pierwill-rustcmiddle-lint, r=oli-obk
Edit rustc_middle::lint::LintSource docs

Edit punctuation in doc comment for [rustc_middle::lint::LintSource::CommandLine](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/lint/enum.LintSource.html#variant.CommandLine).
2020-12-23 00:13:33 +01:00
Guillaume Gomez
26f2d8e80b
Rollup merge of #80136 - aDotInTheVoid:74824-test, r=Mark-Simulacrum
Add test for issue #74824

It was fixed a while ago, but doesn't have a test.

Closes #74824
2020-12-23 00:13:31 +01:00
Tyson Nottingham
03eb75f759 rustc_query_system: avoid race condition when using edge_count 2020-12-22 14:12:57 -08:00
Tyson Nottingham
22ed75158b rustc_query_system: add more comments for dependency graph 2020-12-22 14:12:57 -08:00
Tyson Nottingham
d6b2aaed7d rustc_query_system: rename intern_node to intern_new_node 2020-12-22 14:12:57 -08:00
Tyson Nottingham
712fcae13a rustc_query_system: remove inline annotation from edge_count
This isn't called frequently enough to justify inlining.
2020-12-22 14:12:57 -08:00
Tyson Nottingham
4f76266295 rustc_query_system: minor cleanup
Remove effectively unused parameter and delete out of date comment.
2020-12-22 14:12:57 -08:00
Tyson Nottingham
dd1ab840d2 rustc_query_system: use more space-efficient edges representation
Use single vector of edges rather than per-node vector. There is a small
hit to instruction counts (< 0.5%), but the memory savings make up for it.
2020-12-22 14:12:57 -08:00
Tyson Nottingham
ea47269f5f rustc_query_system: share previous graph edges with current graph
Reduce memory consumption by sharing the previous dependency graph's
edges with the current graph when it is known to be valid to do so. It
is known to be valid whenever we mark a node green because all of its
dependencies were green. It is *not* known to be valid when we mark a
node green because we re-executed its query and its result was the same
as in the previous compilation session. In that case, the dependency set
might have changed (we don't try to determine whether or not it changed
and whether or not we can share).
2020-12-22 14:12:57 -08:00
Tyson Nottingham
f6d6b0c96d rustc_query_system: share previous graph data with current graph
Reduce memory consumption by taking advantage of red/green algorithm
properties to share the previous dependency graph's node data with the
current graph instead of storing node data redundantly. Red nodes can
share the `DepNode`, and green nodes can share the `DepNode` and
`Fingerprint`. Edges will be shared when possible in a later change.
2020-12-22 14:12:57 -08:00
bors
969b42d8c0 Auto merge of #80242 - Nadrieril:explain-and-factor-splitting, r=varkor
Clarify constructor splitting in exhaustiveness checking

I reworked the explanation of the algorithm completely to make it properly account for the various extensions we've added. This includes constructor splitting, which was previously not clearly included in the algorithm. This makes wildcards less magical; I added some detailed examples; and this distinguishes clearly between constructors that only make sense in patterns (like ranges) and those that make sense for values (like `Some`). This reformulation had been floating around in my mind for a while, and I'm quite happy with how it turned out. Let me know how you feel about it.
I also factored out all three cases of splitting (wildcards, ranges and slices) into dedicated structs to encapsulate the complicated bits.
I measured no perf impact but I don't trust my local measurements for refactors since https://github.com/rust-lang/rust/pull/79284.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
2020-12-22 21:51:04 +00:00
ThePuzzlemaker
5e6dc927f7
Add regression test for #80179 2020-12-22 13:26:28 -06:00
ThePuzzlemaker
4f6be466fd
Suggest fn ptr rather than fn item and suggest to use Fn trait bounds rather than the unique closure type in E0121
This is a squash of the titular commit along with these minor commits:
- Improve note
- Improve note pt2
2020-12-22 13:26:28 -06:00
bors
bb1fbbf844 Auto merge of #80177 - tgnottingham:foreign_defpathhash_registration, r=Aaron1011
rustc_query_system: explicitly register reused dep nodes

Register nodes that we've reused from the previous session explicitly
with `OnDiskCache`. Previously, we relied on this happening as a side
effect of accessing the nodes in the `PreviousDepGraph`. For the sake of
performance and avoiding unintended side effects, register explictily.
2020-12-22 19:02:28 +00:00
pierwill
f078f7cd64 docs: Update rustc_middle::middle::region::ScopeTree
This corrects the return type in docs for yield_in_source method.

Closes #80287.
2020-12-22 10:57:05 -08:00
Mark Rousskov
a448f88b69 Utilize PGO for rustc linux dist builds
This implements support for applying PGO to the rustc compilation step (not
standard library or any tooling, including rustdoc). Expanding PGO to more tools
is not terribly difficult but will involve more work and greater CI time
commitment.

For the same reason of avoiding greater time commitment, this currently avoids
implementing for platforms outside of x86_64-unknown-linux-gnu, though in
practice it should be quite simple to extend over time to more platforms. The
initial implementation is intentionally minimal here to avoid too much work
investment before we start seeing wins for a subset of Rust users.

The choice of workloads to profile here is somewhat arbitrary, but the general
rationale was to aim for a small set that largely avoided time regressions on
perf.rust-lang.org's full suite of crates. The set chosen is libcore, cargo (and
its dependencies), and a few ad-hoc stress tests from perf.rlo. The stress tests
are arguably the most controversial, but they benefit those cases (avoiding
regressions) and do not really remove wins from other benchmarks.

The primary next step after this PR lands is to implement support for PGO in
LLVM. It is unclear whether we can afford a full LLVM rebuild in CI, though, so
the approach taken there may need to be more staggered. rustc-only PGO seems
well affordable on linux at least, giving us up to 20% wall time wins on some
crates for 15 minutes of extra CI time (1 hour up from 45 minutes).

The PGO data is uploaded to allow others to reuse it if attempting to reproduce
the CI build or potentially, in the future, on other platforms where an
off-by-one strategy is used for dist builds at minimal performance cost.
2020-12-22 12:23:37 -05:00
Joshua Nelson
8842c1ccf3 Fix new ambiguity in the standard library
This caught several bugs where people expected `slice` to link to the
primitive, but it linked to the module instead.

This also uses `cfg_attr(bootstrap)` since the ambiguity only occurs
when compiling with stage 1.
2020-12-22 11:45:23 -05:00
Joshua Nelson
4092891a8f Fix intra-doc links for non-path primitives
This does *not* currently work for associated items that are
auto-implemented by the compiler (e.g. `never::eq`), because they aren't
present in the source code. I plan to fix this in a follow-up PR.
2020-12-22 11:45:23 -05:00
Joshua Nelson
0fd4f8febf Add a custom Res type
- Don't make rustc_resolve::Res public; use a new type alias instead
2020-12-22 11:45:15 -05:00
bors
353f3a3846 Auto merge of #80071 - jyn514:timings, r=Mark-Simulacrum
Add more timing info to rustdoc

This helped me confirm in https://github.com/rust-lang/rust/issues/79103#issuecomment-745737864 that get_blanket_impls is indeed what's taking all the time on stm32.

r? `@Mark-Simulacrum`
2020-12-22 16:09:59 +00:00
PankajChaudhary5
57b5f8cbb9 Improve the code quality by using matches macro 2020-12-22 20:52:38 +05:30
Nadrieril
be23694622 Fix a comment 2020-12-22 15:20:24 +00:00
Nadrieril
85fdb34d3a Apply suggestions from code review
Co-authored-by: varkor <github@varkor.com>
2020-12-22 15:20:24 +00:00
Nadrieril
1c176d1150 Simplify field filtering 2020-12-22 15:20:23 +00:00
Nadrieril
53e03fb7c1 Make the special "missing patterns" constructor real 2020-12-22 15:20:23 +00:00
Nadrieril
2a541cea35 Completely rework the explanation of the algorithm 2020-12-22 15:20:23 +00:00
Nadrieril
43d445c8d1 Pass Matrix explicitly instead of via PatCtxt 2020-12-22 15:20:23 +00:00
Nadrieril
8b38b6859a Inline the constructor-specific split functions 2020-12-22 15:20:23 +00:00
Nadrieril
3141f2d78c Inline all_constructors 2020-12-22 15:20:23 +00:00
Nadrieril
bbb4ac0651 Rebrand MissingConstructors as SplitWildcard 2020-12-22 15:20:23 +00:00
Nadrieril
9d0c2ed913 Factor out SplitVarLenSlice used for slice splitting 2020-12-22 15:20:23 +00:00
Nadrieril
7948f91910 Run the annoying lint separately 2020-12-22 15:20:23 +00:00
Nadrieril
5a24b2c2c7 Factor out SplitIntRange used for integer range splitting 2020-12-22 15:20:23 +00:00
Nadrieril
42b77c709e Add some tests 2020-12-22 15:20:23 +00:00
LingMan
ef75761fb1 Turn helper method into a closure
`replace_prefix` is currently implemented as a method but has no real relation
to the struct it is implemented on. Turn it into a closure and move it into the
only method from which it is called.
2020-12-22 16:18:34 +01:00
Guillaume Gomez
64afdedfb8 Rework beautify_doc_string so that it returns a Symbol instead of a String 2020-12-22 16:05:38 +01:00
Joshua Nelson
9cd992f394 Add some intra-doc links to compiler docs 2020-12-22 09:54:23 -05:00
Wesley Wiser
56154a1147 Add example to lint docs 2020-12-22 09:33:16 -05:00
Wesley Wiser
f1eb88b28a Revert "Promote missing_fragment_specifier to hard error"
This reverts commit 02eae432e7.
2020-12-22 09:33:16 -05:00
Wesley Wiser
9414f0b833 Revert "Remove missing_fragment_specifier lint"
This reverts commit 5ba961018c.
2020-12-22 08:35:52 -05:00
bors
0fe1dc6ac2 Auto merge of #79451 - usbalbin:array_zip, r=m-ou-se
Added [T; N]::zip()

This is my first PR to rust so I hope I have done everything right, or at least close :)

---

This is PR adds the array method `[T; N]::zip()` which, in my mind, is a natural extension to #75212.

My implementation of `zip()` is mostly just a modified copy-paste of `map()`. Should I keep the comments? Also am I right in assuming there should be no way for the `for`-loop to panic, thus no need for the dropguard seen in the `map()`-function?

The doc comment is in a similar way a slightly modified copy paste of [`Iterator::zip()`](https://doc.rust-lang.org/beta/std/iter/trait.Iterator.html#method.zip)

`@jplatte` mentioned in [#75490](https://github.com/rust-lang/rust/pull/75490#issuecomment-677790758) `zip_with()`,
> zip and zip_with seem like they would be useful :)

is this something I should add (assuming there is interest for this PR at all :))
2020-12-22 13:19:40 +00:00
Linus Färnstrand
454f3ed902
Update library/std/src/sys/windows/thread_parker.rs
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2020-12-22 12:33:11 +01:00
Linus Färnstrand
865e4797df Fix compare_and_swap in Windows thread_parker 2020-12-22 12:24:17 +01:00
Linus Färnstrand
3eef20ffa0 Improve documentation on success and failure arguments 2020-12-22 12:19:46 +01:00
Linus Färnstrand
427996a286 Fix documentation typo 2020-12-22 12:19:46 +01:00