Commit Graph

135590 Commits

Author SHA1 Message Date
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
Linus Färnstrand
7f35e2d573 Add doc aliases to compare_exchange[_weak] 2020-12-22 12:19:46 +01:00
Linus Färnstrand
828d4ace4d Migrate standard library away from compare_and_swap 2020-12-22 12:19:46 +01:00
Linus Färnstrand
4252e48256 Add documentation on migrating away from compare_and_swap 2020-12-22 12:17:43 +01:00
Linus Färnstrand
3abba5e21f Deprecate compare_and_swap on all atomic types 2020-12-22 12:17:43 +01:00
bors
75e1acb63a Auto merge of #78242 - Nadrieril:rename-overlapping_endpoints-lint, r=varkor
Rename `overlapping_patterns` lint

As discussed in https://github.com/rust-lang/rust/issues/65477. I also tweaked a few things along the way.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
2020-12-22 10:32:03 +00:00
bors
793931f422 Auto merge of #80264 - tmiasko:stdarch, r=Amanieu
Update stdarch submodule

Changes:

* Avx512bw
* Move code out of constify macros
2020-12-22 06:36:22 +00:00
pierwill
80aa551d66 docs: Edit rustc_middle::middle::privacy
Add descriptions of `AccessLevel` and `AccessLevels`.

Add missing punctuation.
2020-12-21 20:05:05 -08:00
Eric Huss
1339c81390 Update books 2020-12-21 19:00:49 -08:00
pierwill
163f5da322 Add installation commands to x tool README 2020-12-21 17:18:48 -08:00
bors
9310aff66c Auto merge of #80208 - bugadani:generics-of-alloc, r=matthewjasper
Reserve necessary space for params in generics_of

Always reserve space for the exact number of generic parameters we need in generics_of. As far as I can see, the default is 0/4 elements based on has_self, and the vector grows on after that.
2020-12-22 00:20:14 +00:00
Yoshua Wuyts
c2281cc189 Stabilize core::slice::fill 2020-12-22 00:16:04 +01:00
pierwill
d3900d3775 Document rustc_middle::lint::LevelSource
This is to clarify the difference between `LevelSource`
and `LintLevelSource`.

Appease x.py fmt.
2020-12-21 15:03:00 -08:00