Commit Graph

135475 Commits

Author SHA1 Message Date
Stein Somers
f327a352b8 BTreeMap: test full nodes a little more 2020-12-24 16:48:27 +01:00
bors
b2516121e2 Auto merge of #79742 - GuillaumeGomez:move-tooltips-messages-out-of-html, r=Nemo157
Move tooltips messages out of html

First thing first: nothing in the output has changed. You still have the "i" on the left of code blocks examples when they have `ignore`, `compile_fail`, `should_panic` and `edition`. The behavior also remains the same: when you hover the "i", you have the corresponding message showing up.

So now, why this PR then? I realized recently that we were actually generating those messages into the HTML every time whereas all messages are the same (except for the edition ones, I'll come back to it later). So instead of generating more content, I simply moved it inside the CSS thanks to pseudo elements (`::before` and `::after`). The message is now inside `::after` and we use the `::before` to have the small triangle on the left of the message. So now, we have less HTML generated which is seems pretty nice.

So now, back to the `edition` change: the message is globally the same, but the "edition" itself can be different (2015 or 2018 currently, I expect 2021 to arrive not too far in the future). So the only difference for it is that I added a new attribute on the tooltip called `edition` which contains this information. Then, the `::after` uses it inside its `content` (you can get the content of an element's attribute by using `attr` and concat different strings by simply having them after the other).

Don't hesitate if a part of my explanations isn't clear.

r? `@jyn514`
2020-12-24 15:22:28 +00:00
Stein Somers
9e618bacf2 BTreeMap: make test cases more explicit on failure 2020-12-24 15:58:57 +01:00
bors
2acf6ee6d2 Auto merge of #80295 - GuillaumeGomez:beautify-rework, r=petrochenkov
Rework beautify_doc_string so that it returns a Symbol instead of a String

This commit comes from https://github.com/rust-lang/rust/pull/80261, the goal here is to inspect the impact on performance of this change on its own.

The idea of rewriting `beautify_doc_string` is to not go through `String` if we don't need to update the doc comment to be able to keep the original `Symbol` and also to have better performance.

r? `@jyn514`
2020-12-24 11:30:24 +00:00
Stein Somers
8824efd61c BTreeMap: avoid implicit use of node length in flight 2020-12-24 11:41:40 +01:00
bors
c34c015fe2 Auto merge of #77692 - PankajChaudhary5:issue-76630, r=davidtwco
Added better error message for shared borrow treated as unique for purposes of lifetimes

Part of Issue #76630

r? `@jyn514`
2020-12-24 07:32:19 +00:00
bors
5b104fc1bd Auto merge of #80249 - calebcartwright:update-rustfmt, r=Mark-Simulacrum
update rustfmt to v1.4.30

Contains fixes for a few reported bugs on current nightly (1.4.29)

Notes in: https://github.com/rust-lang/rustfmt/releases/tag/v1.4.30
2020-12-24 04:41:11 +00:00
bors
49b315123e Auto merge of #79589 - tgnottingham:shared_dep_graph, r=michaelwoerister
rustc_query_system: reduce dependency graph memory usage

This change implements, at a high level, two space optimizations to the dependency graph.

The first optimization is sharing graph data with the previous dependency graph. Whenever we intern a node, we know whether that node is new (not in the previous graph) or not, and if not, the color of the node in the previous graph.

Red and green nodes have their `DepNode` present in the previous graph, so for that piece of node data, we can just store the index of the node in the previous graph rather than duplicate the `DepNode`. Green nodes additionally have the the same result `Fingerprint`, so we can avoid duplicating that too. Finally, we distinguish between "light" and "dark" green nodes, where the latter are nodes that were marked green because all of their dependencies were marked green. These nodes can additionally share edges with the previous graph, because we know that their set of dependencies is the same (technically, light green and red nodes can have the same dependencies too, but we don't try to figure out whether or not that's the case).

Also, some effort is made to pack data tightly, and to avoid storing `DepNode`s as map keys more than once.

The second optimization is storing edges in a more compact representation, as in the `SerializedDepGraph`, that is, in a single vector, rather than one `EdgesVec` per node. An `EdgesVec` is a `SmallVec` with an inline buffer for 8 elements. Each `EdgesVec` is, at minimum, 40 bytes, and has a per-node overhead of up to 40 bytes. In the ideal case of exactly 8 edges, then 32 bytes are used for edges, and the overhead is 8 bytes. But most of the time, the overhead is higher.

In contrast, using a single vector to store all edges, and having each node specify its start and end elements as 4 byte indices into the vector has a constant overhead of 8 bytes--the best case scenario for the per-node `EdgesVec` approach.

The downside of this approach is that `EdgesVec`s built up during query execution have to be copied into the vector, whereas before, we could just take ownership over them. However, we mostly make up for this because the single vector representation enables a more efficient implementation of `DepGraph::serialize`.
2020-12-24 01:06:36 +00:00
bors
3d10d3e49d Auto merge of #79521 - ssomers:btree_cleanup_2, r=Mark-Simulacrum
BTreeMap: relax the explicit borrow rule to make code shorter and safer

Expressions like `.reborrow_mut().into_len_mut()` are annoyingly long, and kind of dangerous for the reason `reborrow_mut()` is unsafe. By relaxing the single rule, we no longer have to make an exception for functions with a `borrow` name and functions like `as_leaf_mut`. This is largely restoring the declaration style of the btree::node API about a year ago, but with more explanation and consistency.

r? `@Mark-Simulacrum`
2020-12-23 21:43:28 +00:00
pierwill
df94bfceb1
Fix typo 2020-12-23 13:08:15 -08:00
Joshua Nelson
6dc4f7a9d4 Don't unnecessarily override attrs for Module
They were never changed from the default, which you can get with
`tcx.get_attrs()`.
2020-12-23 15:25:30 -05:00
Eric Huss
0bfc45aa85 Add libz-sys to rustc-workspace-hack.
https://github.com/alexcrichton/curl-rust/pull/351 changed
curl-rust to no longer enable the default features of libz-sys.
Because rustfmt includes rustc-workspace-hack with the
rustc-workspace-hack/all-static feature (sometimes), it ends up building
libz-sys without the default features. This causes a duplicate
with other packages (like rls) which enable the default
features.
2020-12-23 12:18:15 -08:00
Guillaume Gomez
152d4e74be Update HTML DOM attribute "edition" to "data-edition" 2020-12-23 20:27:12 +01:00
Yenlin Chen
ecba49c1bd Fixed formatting 2020-12-23 19:10:59 +00:00
Yenlin Chen
f459b0fea5 Addressed feedbacks
Also updated the mir-opt test output files.
2020-12-23 18:55:37 +00:00
bors
7f9c43cf98 Auto merge of #79788 - pietroalbini:bootstrap-tarball, r=Mark-Simulacrum
Refactor dist tarballs generation

Before this PR, each tarball we ship as part of a release was generated by manually creating the directory structure and invoking `rust-installer generate`. This means each tarball was slightly different, adding new ones meant copy-pasting the code generating another tarball and removing the useless parts, and more importantly refactoring how tarballs are generated is extremely time-consuming.

This PR introduces a new abstraction in rustbuild, `Tarball`. The `Tarball` struct provides a trivial API to generate simple tarballs, and can get out of the way when more complex tarballs have to generate. For example, the whole code to generate the `build-manifest` tarball is now the following:

```rust
let tarball = Tarball::new(builder, "build-manifest", &self.target.triple);
tarball.add_file(&build_manifest, "bin", 0o755);
tarball.generate()
```

One notable change between the old tarballs and the new ones is that the "overlay" (README.md, COPYRIGHT, LICENSE-APACHE and LICENSE-MIT) is now available in every produced tarball, while before each tarball inconsistently had or didn't have those files. Tarballs that need a different overlay have a way to change which files to include (with the `set_overlay` method):

```rust
let mut tarball = Tarball::new(builder, "rustfmt", &target.triple);
tarball.set_overlay(OverlayKind::Rustfmt);
tarball.add_file(rustfmt, "bin", 0o755);
tarball.add_file(cargofmt, "bin", 0o755);
tarball.add_legal_and_readme_to("share/doc/rustfmt");
Some(tarball.generate())
```

The PR should be reviewed commit-by-commit, as each commit migrated a separate tarball to use `Tarball`. During development i made sure every tarball can still be generated, and for the most compex tarballs I manually ensured the list of files between the old and new tarballs did not have unexpected changes.

r? `@Mark-Simulacrum`
2020-12-23 18:50:01 +00:00
Pietro Albini
8736731f70
bootstrap: convert reproducible-artifacts to use Tarball 2020-12-23 19:40:45 +01:00
Pietro Albini
2c081769b0
bootstrap: use the normal compiler to build std 2020-12-23 19:35:22 +01:00
Pietro Albini
ae12a0c200
bootstrap: avoid producing the rust tarball during dry runs 2020-12-23 19:35:22 +01:00
Pietro Albini
f18335edb2
bootstrap: convert rustc-src to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
48924ab708
bootstrap: convert rust to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
1906c42962
bootstrap: convert rust-src to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
2e0a16cf0d
bootstrap: convert rust-analyzer to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
cfb23e845e
bootstrap: convert rls to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
2b54f0de37
bootstrap: convert rustfmt to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
2073ea5c07
bootstrap: convert miri to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
32afb3c436
bootstrap: simplify including licenses and readmes to tarballs 2020-12-23 19:35:22 +01:00
Pietro Albini
521b884913
bootstrap: convert clippy to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
8a711a00a7
bootstrap: convert cargo to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
c4aaff65f0
bootstrap: convert rust-analysis to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
c0cadc9eb7
bootstrap: convert rustc-dev to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
79f60fbd04
bootstrap: convert rust-std to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
fd4515cb3f
bootstrap: refactor showing the "dist" info 2020-12-23 19:35:22 +01:00
Pietro Albini
0a2e1c5a2c
bootstrap: convert rustc to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
82d9eaa54d
bootstrap: convert rust-mingw to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
8ca46fc7a8
bootstrap: convert rustc-docs to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
c768ce1384
bootstrap: convert rust-docs to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
7be85701cd
bootstrap: convert llvm-tools to use Tarball 2020-12-23 19:35:22 +01:00
Pietro Albini
ddf82636c6
bootstrap: convert build-manifest to use the new Tarball struct 2020-12-23 19:35:22 +01:00
Eric Huss
468af39ef2 Update cargo 2020-12-23 08:58:14 -08:00
bors
e937ae9493 Auto merge of #80328 - flip1995:clippyup, r=Mark-Simulacrum
Clippy: Revert change from last sync

r? `@Manishearth`

cc `@ebroto`

Note that the commit e898015 doesn't exist like this in the Clippy repo. I didn't want to do a full sync, because this would've included at least one new lint, which I wanted to avoid a week before beta is branched. This just reverts one commit from the last sync.
2020-12-23 15:57:13 +00:00
Joshua Nelson
ceb66ad464 Add more tests 2020-12-23 09:23:05 -05:00
bors
3ffea60dd5 Auto merge of #80262 - Mark-Simulacrum:pgo-rustc, r=pietroalbini
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 implementation time commitment,
implementing for platforms outside of x86_64-unknown-linux-gnu is skipped.
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 with this PR, 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.

r? `@michaelwoerister` (but tell me if you don't want to / don't feel comfortable approving and we can find others)
2020-12-23 12:54:56 +00:00
Ikko Ashimine
87397080b6
Fix typo in simplify_try.rs
assigment -> assignment
2020-12-23 21:11:59 +09:00
flip1995
2accbf1a87
Special sync of 'e89801553ddbaccdeb2eac4db08900edb51ac7ff' 2020-12-23 10:57:35 +01:00
Philipp Krones
e89801553d
Revert "Pass Clippy args also trough RUSTFLAGS" 2020-12-23 10:52:14 +01:00
bors
87eecd40e8 Auto merge of #79261 - faern:deprecate-compare-and-swap, r=Amanieu
Deprecate atomic compare_and_swap method

Finish implementing [RFC 1443](https://github.com/rust-lang/rfcs/blob/master/text/1443-extended-compare-and-swap.md) (https://github.com/rust-lang/rfcs/pull/1443).

It was decided to deprecate `compare_and_swap` [back in Rust 1.12 already](https://github.com/rust-lang/rust/issues/31767#issuecomment-215903038). I can't find any info about that decision being reverted. My understanding is just that it has been forgotten. If there has been a decision on keeping `compare_and_swap` then it's hard to find, and even if this PR does not go through it can act as a place where people can find out about the decision being reverted.

Atomic operations are hard to understand, very hard. And it does not help that there are multiple similar methods to do compare and swap with. They are so similar that for a reader it might be hard to understand the difference. This PR aims to make that simpler by finally deprecating `compare_and_swap` which is essentially just a more limited version of `compare_exchange`. The documentation is also updated (according to the RFC text) to explain the differences a bit better.

Even if we decide to not deprecate `compare_and_swap`. I still think the documentation for the atomic operations should be improved to better describe their differences and similarities. And the documentation can be written nicer than the PR currently proposes, but I wanted to start somewhere. Most of it is just copied from the RFC.

The documentation for `compare_exchange` and `compare_exchange_weak` indeed describe how they work! The problem is that they are more complex and harder to understand than `compare_and_swap`. So for someone who does not fully grasp this they might fall back to using `compare_and_swap`. Making the documentation outline the similarities and differences might build a bridge for people so they can cross over to the more powerful and sometimes more efficient operations.

The conversions I do to avoid the `std` internal deprecation errors are very straight forward `compare_and_swap -> compare_exchange` changes where the orderings are just using the mapping in the new documentation. Only in one place did I use `compare_exchange_weak`. This can probably be improved further. But the goal here was not for those operations to be perfect. Just to not get worse and to allow the deprecation to happen.
2020-12-23 09:32:38 +00:00
bors
28d73a3ee3 Auto merge of #80099 - jyn514:visibility-on-demand, r=GuillaumeGomez
Remove `DefPath` from `Visibility` and calculate it on demand

Depends on #80090 and should not be merged before. Helps with https://github.com/rust-lang/rust/issues/79103 and https://github.com/rust-lang/rust/issues/76382.

cc https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284 - `@nnethercote` I figured it out! It was simpler than I expected :)

This brings the size of `clean::Visibility` down from 40 bytes to 8.

Note that this does *not* remove `clean::Visibility`, even though it's now basically the same as `ty::Visibility`, because the `Invsible` variant means something different from `Inherited` and I thought it would be be confusing to merge the two. See the new comments on `impl Clean for ty::Visibility` for details.
2020-12-23 06:39:15 +00:00
PankajChaudhary5
c625d3183c Updated the match with the matches macro 2020-12-23 11:02:04 +05:30
bors
18b745e9bf Auto merge of #80095 - jyn514:stability-on-demand, r=GuillaumeGomez
[rustdoc] Calculate stability, const_stability, and deprecation on-demand

Previously, they would always be calculated ahead of time, which bloated the size of `clean::Item`.

Builds on https://github.com/rust-lang/rust/pull/80090 and should not be merged before. Helps with https://github.com/rust-lang/rust/issues/79103 and https://github.com/rust-lang/rust/issues/76382.

cc https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284

This brings `Item` down to 568 bytes, down from 616.
2020-12-23 03:35:32 +00:00