]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agobootstrap: convert miri to use Tarball
Pietro Albini [Fri, 27 Nov 2020 17:03:41 +0000 (18:03 +0100)]
bootstrap: convert miri to use Tarball

3 years agobootstrap: simplify including licenses and readmes to tarballs
Pietro Albini [Fri, 27 Nov 2020 16:56:22 +0000 (17:56 +0100)]
bootstrap: simplify including licenses and readmes to tarballs

3 years agobootstrap: convert clippy to use Tarball
Pietro Albini [Fri, 27 Nov 2020 16:43:03 +0000 (17:43 +0100)]
bootstrap: convert clippy to use Tarball

3 years agobootstrap: convert cargo to use Tarball
Pietro Albini [Fri, 27 Nov 2020 12:11:11 +0000 (13:11 +0100)]
bootstrap: convert cargo to use Tarball

3 years agobootstrap: convert rust-analysis to use Tarball
Pietro Albini [Fri, 27 Nov 2020 11:52:44 +0000 (12:52 +0100)]
bootstrap: convert rust-analysis to use Tarball

3 years agobootstrap: convert rustc-dev to use Tarball
Pietro Albini [Fri, 27 Nov 2020 11:46:02 +0000 (12:46 +0100)]
bootstrap: convert rustc-dev to use Tarball

3 years agobootstrap: convert rust-std to use Tarball
Pietro Albini [Thu, 26 Nov 2020 21:54:35 +0000 (22:54 +0100)]
bootstrap: convert rust-std to use Tarball

3 years agobootstrap: refactor showing the "dist" info
Pietro Albini [Thu, 26 Nov 2020 21:50:38 +0000 (22:50 +0100)]
bootstrap: refactor showing the "dist" info

3 years agobootstrap: convert rustc to use Tarball
Pietro Albini [Thu, 26 Nov 2020 21:42:52 +0000 (22:42 +0100)]
bootstrap: convert rustc to use Tarball

3 years agobootstrap: convert rust-mingw to use Tarball
Pietro Albini [Thu, 26 Nov 2020 21:29:33 +0000 (22:29 +0100)]
bootstrap: convert rust-mingw to use Tarball

3 years agobootstrap: convert rustc-docs to use Tarball
Pietro Albini [Thu, 26 Nov 2020 21:24:34 +0000 (22:24 +0100)]
bootstrap: convert rustc-docs to use Tarball

3 years agobootstrap: convert rust-docs to use Tarball
Pietro Albini [Thu, 26 Nov 2020 21:20:45 +0000 (22:20 +0100)]
bootstrap: convert rust-docs to use Tarball

3 years agobootstrap: convert llvm-tools to use Tarball
Pietro Albini [Thu, 26 Nov 2020 16:47:48 +0000 (17:47 +0100)]
bootstrap: convert llvm-tools to use Tarball

3 years agobootstrap: convert build-manifest to use the new Tarball struct
Pietro Albini [Thu, 26 Nov 2020 15:52:20 +0000 (16:52 +0100)]
bootstrap: convert build-manifest to use the new Tarball struct

3 years agoAuto merge of #80262 - Mark-Simulacrum:pgo-rustc, r=pietroalbini
bors [Wed, 23 Dec 2020 12:54:56 +0000 (12:54 +0000)]
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)

3 years agoAuto merge of #79261 - faern:deprecate-compare-and-swap, r=Amanieu
bors [Wed, 23 Dec 2020 09:32:38 +0000 (09:32 +0000)]
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.

3 years agoAuto merge of #80099 - jyn514:visibility-on-demand, r=GuillaumeGomez
bors [Wed, 23 Dec 2020 06:39:15 +0000 (06:39 +0000)]
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.

3 years agoAuto merge of #80095 - jyn514:stability-on-demand, r=GuillaumeGomez
bors [Wed, 23 Dec 2020 03:35:32 +0000 (03:35 +0000)]
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.

3 years agoAuto merge of #80314 - GuillaumeGomez:rollup-9rc48vx, r=GuillaumeGomez
bors [Wed, 23 Dec 2020 00:41:46 +0000 (00:41 +0000)]
Auto merge of #80314 - GuillaumeGomez:rollup-9rc48vx, r=GuillaumeGomez

Rollup of 17 pull requests

Successful merges:

 - #80136 (Add test for issue #74824)
 - #80203 (Edit rustc_middle::lint::LintSource docs)
 - #80204 (docs: Edit rustc_middle::ty::query::on_disk_cache)
 - #80219 (Fix labels for 'Library Tracking Issue' template)
 - #80222 (Fix rustc-std-workspace-core documentation)
 - #80223 (docs: Fix outdated crate reference)
 - #80225 (Add module-level docs to rustc_middle::ty)
 - #80241 (Fix typo)
 - #80248 (Remove `I-prioritize` from Zulip topic)
 - #80266 (Remove redundant test)
 - #80272 (rustc_span: Provide a reserved identifier check for a specific edition)
 - #80285 (Update books)
 - #80286 (docs: Edit rustc_middle::middle::privacy)
 - #80297 (Add some intra-doc links to compiler docs)
 - #80298 (Improve the code quality by using matches macro)
 - #80299 (Turn helper method into a closure)
 - #80302 (docs: Update rustc_middle::middle::region::ScopeTree)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #80302 - pierwill:fix-80287, r=lcnr
Guillaume Gomez [Tue, 22 Dec 2020 23:14:01 +0000 (00:14 +0100)]
Rollup merge of #80302 - pierwill:fix-80287, r=lcnr

docs: Update rustc_middle::middle::region::ScopeTree

Correct return type in docs for [`yield_in_source`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/middle/region/struct.ScopeTree.html#method.yield_in_scope) method.

Closes #80287.

3 years agoRollup merge of #80299 - LingMan:helper, r=lcnr
Guillaume Gomez [Tue, 22 Dec 2020 23:13:59 +0000 (00:13 +0100)]
Rollup merge of #80299 - LingMan:helper, r=lcnr

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.

`@rustbot` modify labels +C-cleanup +T-compiler
r? `@lcnr`

3 years agoRollup merge of #80298 - PankajChaudhary5:PankajChaudhary, r=GuillaumeGomez
Guillaume Gomez [Tue, 22 Dec 2020 23:13:56 +0000 (00:13 +0100)]
Rollup merge of #80298 - PankajChaudhary5:PankajChaudhary, r=GuillaumeGomez

Improve the code quality by using matches macro

Improved the code quality by using matches macro
r? `@GuillaumeGomez`

3 years agoRollup merge of #80297 - jyn514:more-docs, r=bjorn3
Guillaume Gomez [Tue, 22 Dec 2020 23:13:53 +0000 (00:13 +0100)]
Rollup merge of #80297 - jyn514:more-docs, r=bjorn3

Add some intra-doc links to compiler docs

r? `@pierwill`

3 years agoRollup merge of #80286 - pierwill:rustc-middle-privacy, r=petrochenkov
Guillaume Gomez [Tue, 22 Dec 2020 23:13:52 +0000 (00:13 +0100)]
Rollup merge of #80286 - pierwill:rustc-middle-privacy, r=petrochenkov

docs: Edit rustc_middle::middle::privacy

Add descriptions of `AccessLevel` and `AccessLevels`.

Add missing punctuation.

3 years agoRollup merge of #80285 - ehuss:update-books, r=ehuss
Guillaume Gomez [Tue, 22 Dec 2020 23:13:50 +0000 (00:13 +0100)]
Rollup merge of #80285 - ehuss:update-books, r=ehuss

Update books

## nomicon

2 commits in d8383b65f7948c2ca19191b3b4bd709b403aaf45..a5a48441d411f61556b57d762b03d6874afe575d
2020-11-22 10:24:42 -0500 to 2020-12-06 10:39:41 +0900
- Update atomics.md (rust-lang/nomicon#249)
- Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate` (rust-lang/nomicon#248)

## reference

2 commits in a8afdca5d0715b2257b6f8b9a032fd4dd7dae855..b278478b766178491a8b6f67afa4bcd6b64d977a
2020-11-30 06:44:46 -0800 to 2020-12-21 18:18:03 -0800
- Update unions for safe ManuallyDrop assignment. (rust-lang/reference#912)
- Removing ambiguity in type-layout.md (rust-lang/reference#911)

## book

25 commits in a190438d77d28041f24da4f6592e287fab073a61..5bb44f8b5b0aa105c8b22602e9b18800484afa21
2020-11-16 10:44:08 -0600 to 2020-12-18 20:07:31 -0500
- Make some further edits to rust-lang/book#2447
- Merge remote-tracking branch 'origin/pr/2447'
- Remove copied and dangling link brackets
- Merge remote-tracking branch 'origin/pr/2359'
- Override toolchain to nightly for run lints action. (rust-lang/book#2528)
- Remove an uneeded 'static lifetime (rust-lang/book#1752)
- Fixes rust-lang/book#2330. Clarify why the lock is held too long
- Update paragraph about rustfmt in Chapter 1.2 (rust-lang/book#2304)
- Clarify language around  further from rust-lang/book#2418
- Merge remote-tracking branch 'origin/pr/2418'
- Merge remote-tracking branch 'origin/pr/2475'
- Add some further edits to rust-lang/book#2433
- Merge remote-tracking branch 'origin/pr/2433'
- Note all the method families to handle integer overflow
- Merge remote-tracking branch 'origin/pr/2405'
- Fix rust-lang/book#1855 - incorporate new reference cycle diagram
- Make some further edits to the changes in rust-lang/book#1886
- Merge remote-tracking branch 'origin/pr/1886'
- Make some further edits to rust-lang/book#1998
- Merge remote-tracking branch 'origin/pr/1998'
- Update Rust version and output (rust-lang/book#2518)
- Fix typo, regarding privileged ports being up to 1023 instead of 1024 (rust-lang/book#2509)
- Change "appendixes" to "appendices" in intro. (rust-lang/book#2498)
- Update 16-11 to use method call expression for `clone` (rust-lang/book#2511)
- Correct chapter 20 final listing (rust-lang/book#2516)

## rust-by-example

7 commits in 236c734a2cb323541b3394f98682cb981b9ec086..1cce0737d6a7d3ceafb139b4a206861fb1dcb2ab
2020-11-30 14:05:49 -0300 to 2020-12-21 17:36:29 -0300
- Add book.description in book.toml (rust-lang/rust-by-example#1397)
- Simplify the call of filter_map (rust-lang/rust-by-example#1396)
- Update README.md (rust-lang/rust-by-example#1382)
- Add missing main function in static life time example. (rust-lang/rust-by-example#1383)
- Clarify first matching arm and all possible values (rust-lang/rust-by-example#1395)
- Clarify distinction between for iter and into_iter (rust-lang/rust-by-example#1394)
- Drop extern crate (rust-lang/rust-by-example#1393)

3 years agoRollup merge of #80272 - petrochenkov:kwed, r=oli-obk
Guillaume Gomez [Tue, 22 Dec 2020 23:13:48 +0000 (00:13 +0100)]
Rollup merge of #80272 - petrochenkov:kwed, r=oli-obk

rustc_span: Provide a reserved identifier check for a specific edition

while keeping edition evaluation lazy because it may be expensive.

Needed for https://github.com/rust-lang/rust/pull/80226.

3 years agoRollup merge of #80266 - bugadani:dup-test, r=jyn514
Guillaume Gomez [Tue, 22 Dec 2020 23:13:47 +0000 (00:13 +0100)]
Rollup merge of #80266 - bugadani:dup-test, r=jyn514

Remove redundant test

Remove ignored test. This test can also be found at src/test/rustdoc-ui/intra-doc/double-anchor.rs and the second version isn't ignored.

r? ``@jyn514``

3 years agoRollup merge of #80248 - camelid:prioritize-zulip-topic, r=Mark-Simulacrum
Guillaume Gomez [Tue, 22 Dec 2020 23:13:45 +0000 (00:13 +0100)]
Rollup merge of #80248 - camelid:prioritize-zulip-topic, r=Mark-Simulacrum

Remove `I-prioritize` from Zulip topic

It doesn't add anything since every topic in
`t-compiler/wg-prioritization/alerts` is about prioritization.
And it makes it harder to see the issue title, which is what the topic
is actually about.

cc ``@rust-lang/wg-prioritization``

3 years agoRollup merge of #80241 - pierwill:patch-12, r=lcnr
Guillaume Gomez [Tue, 22 Dec 2020 23:13:43 +0000 (00:13 +0100)]
Rollup merge of #80241 - pierwill:patch-12, r=lcnr

Fix typo

Fix typo in rustc_middle::ty::inhabitedness::DefIdForest docs.

3 years agoRollup merge of #80225 - pierwill:patch-11, r=lcnr
Guillaume Gomez [Tue, 22 Dec 2020 23:13:41 +0000 (00:13 +0100)]
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).

3 years agoRollup merge of #80223 - pierwill:patch-10, r=lcnr
Guillaume Gomez [Tue, 22 Dec 2020 23:13:40 +0000 (00:13 +0100)]
Rollup merge of #80223 - pierwill:patch-10, r=lcnr

docs: Fix outdated crate reference

3 years agoRollup merge of #80222 - GreenRecycleBin:daniel/fix-rustc-std-workspace-core-document...
Guillaume Gomez [Tue, 22 Dec 2020 23:13:38 +0000 (00:13 +0100)]
Rollup merge of #80222 - GreenRecycleBin:daniel/fix-rustc-std-workspace-core-documentation, r=jyn514

Fix rustc-std-workspace-core documentation

r? ```@steveklabnik```

3 years agoRollup merge of #80219 - camelid:library_tracking_issue-labels, r=m-ou-se
Guillaume Gomez [Tue, 22 Dec 2020 23:13:36 +0000 (00:13 +0100)]
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`````

3 years agoRollup merge of #80204 - pierwill:pierwill-rustcmiddle-ondisk, r=varkor
Guillaume Gomez [Tue, 22 Dec 2020 23:13:34 +0000 (00:13 +0100)]
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.

3 years agoRollup merge of #80203 - pierwill:pierwill-rustcmiddle-lint, r=oli-obk
Guillaume Gomez [Tue, 22 Dec 2020 23:13:33 +0000 (00:13 +0100)]
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).

3 years agoRollup merge of #80136 - aDotInTheVoid:74824-test, r=Mark-Simulacrum
Guillaume Gomez [Tue, 22 Dec 2020 23:13:31 +0000 (00:13 +0100)]
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

3 years agoAuto merge of #80242 - Nadrieril:explain-and-factor-splitting, r=varkor
bors [Tue, 22 Dec 2020 21:51:04 +0000 (21:51 +0000)]
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

3 years agoAuto merge of #80177 - tgnottingham:foreign_defpathhash_registration, r=Aaron1011
bors [Tue, 22 Dec 2020 19:02:28 +0000 (19:02 +0000)]
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.

3 years agodocs: Update rustc_middle::middle::region::ScopeTree
pierwill [Tue, 22 Dec 2020 18:50:41 +0000 (10:50 -0800)]
docs: Update rustc_middle::middle::region::ScopeTree

This corrects the return type in docs for yield_in_source method.

Closes #80287.

3 years agoUtilize PGO for rustc linux dist builds
Mark Rousskov [Mon, 14 Dec 2020 18:50:59 +0000 (13:50 -0500)]
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.

3 years agoAuto merge of #80071 - jyn514:timings, r=Mark-Simulacrum
bors [Tue, 22 Dec 2020 16:09:59 +0000 (16:09 +0000)]
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`

3 years agoImprove the code quality by using matches macro
PankajChaudhary5 [Tue, 22 Dec 2020 15:22:38 +0000 (20:52 +0530)]
Improve the code quality by using matches macro

3 years agoFix a comment
Nadrieril [Tue, 22 Dec 2020 11:28:17 +0000 (11:28 +0000)]
Fix a comment

3 years agoApply suggestions from code review
Nadrieril [Tue, 22 Dec 2020 06:09:54 +0000 (06:09 +0000)]
Apply suggestions from code review

Co-authored-by: varkor <github@varkor.com>
3 years agoSimplify field filtering
Nadrieril [Sat, 19 Dec 2020 07:11:00 +0000 (07:11 +0000)]
Simplify field filtering

3 years agoMake the special "missing patterns" constructor real
Nadrieril [Sun, 20 Dec 2020 00:39:37 +0000 (00:39 +0000)]
Make the special "missing patterns" constructor real

3 years agoCompletely rework the explanation of the algorithm
Nadrieril [Sun, 20 Dec 2020 13:29:39 +0000 (13:29 +0000)]
Completely rework the explanation of the algorithm

3 years agoPass `Matrix` explicitly instead of via `PatCtxt`
Nadrieril [Sun, 20 Dec 2020 14:29:42 +0000 (14:29 +0000)]
Pass `Matrix` explicitly instead of via `PatCtxt`

3 years agoInline the constructor-specific `split` functions
Nadrieril [Sun, 20 Dec 2020 14:22:53 +0000 (14:22 +0000)]
Inline the constructor-specific `split` functions

3 years agoInline `all_constructors`
Nadrieril [Mon, 14 Dec 2020 01:09:06 +0000 (01:09 +0000)]
Inline `all_constructors`

3 years agoRebrand `MissingConstructors` as `SplitWildcard`
Nadrieril [Sun, 13 Dec 2020 23:56:13 +0000 (23:56 +0000)]
Rebrand `MissingConstructors` as `SplitWildcard`

3 years agoFactor out `SplitVarLenSlice` used for slice splitting
Nadrieril [Fri, 11 Dec 2020 22:20:14 +0000 (22:20 +0000)]
Factor out `SplitVarLenSlice` used for slice splitting

3 years agoRun the annoying lint separately
Nadrieril [Sat, 19 Dec 2020 00:37:36 +0000 (00:37 +0000)]
Run the annoying lint separately

3 years agoFactor out `SplitIntRange` used for integer range splitting
Nadrieril [Thu, 10 Dec 2020 13:52:51 +0000 (13:52 +0000)]
Factor out `SplitIntRange` used for integer range splitting

3 years agoAdd some tests
Nadrieril [Sat, 14 Nov 2020 21:50:53 +0000 (21:50 +0000)]
Add some tests

3 years agoTurn helper method into a closure
LingMan [Tue, 22 Dec 2020 15:18:34 +0000 (16:18 +0100)]
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.

3 years agoAdd some intra-doc links to compiler docs
Joshua Nelson [Tue, 22 Dec 2020 14:54:23 +0000 (09:54 -0500)]
Add some intra-doc links to compiler docs

3 years agoAuto merge of #79451 - usbalbin:array_zip, r=m-ou-se
bors [Tue, 22 Dec 2020 13:19:40 +0000 (13:19 +0000)]
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 :))

3 years agoUpdate library/std/src/sys/windows/thread_parker.rs
Linus Färnstrand [Tue, 22 Dec 2020 11:33:11 +0000 (12:33 +0100)]
Update library/std/src/sys/windows/thread_parker.rs

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agoFix compare_and_swap in Windows thread_parker
Linus Färnstrand [Tue, 22 Dec 2020 11:24:17 +0000 (12:24 +0100)]
Fix compare_and_swap in Windows thread_parker

3 years agoImprove documentation on `success` and `failure` arguments
Linus Färnstrand [Sun, 22 Nov 2020 19:36:29 +0000 (20:36 +0100)]
Improve documentation on `success` and `failure` arguments

3 years agoFix documentation typo
Linus Färnstrand [Sun, 22 Nov 2020 19:26:36 +0000 (20:26 +0100)]
Fix documentation typo

3 years agoAdd doc aliases to compare_exchange[_weak]
Linus Färnstrand [Sun, 22 Nov 2020 17:56:47 +0000 (18:56 +0100)]
Add doc aliases to compare_exchange[_weak]

3 years agoMigrate standard library away from compare_and_swap
Linus Färnstrand [Fri, 20 Nov 2020 21:27:50 +0000 (22:27 +0100)]
Migrate standard library away from compare_and_swap

3 years agoAdd documentation on migrating away from compare_and_swap
Linus Färnstrand [Fri, 20 Nov 2020 21:16:15 +0000 (22:16 +0100)]
Add documentation on migrating away from compare_and_swap

3 years agoDeprecate compare_and_swap on all atomic types
Linus Färnstrand [Fri, 20 Nov 2020 20:45:51 +0000 (21:45 +0100)]
Deprecate compare_and_swap on all atomic types

3 years agoAuto merge of #78242 - Nadrieril:rename-overlapping_endpoints-lint, r=varkor
bors [Tue, 22 Dec 2020 10:32:03 +0000 (10:32 +0000)]
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

3 years agoAuto merge of #80264 - tmiasko:stdarch, r=Amanieu
bors [Tue, 22 Dec 2020 06:36:22 +0000 (06:36 +0000)]
Auto merge of #80264 - tmiasko:stdarch, r=Amanieu

Update stdarch submodule

Changes:

* Avx512bw
* Move code out of constify macros

3 years agodocs: Edit rustc_middle::middle::privacy
pierwill [Tue, 22 Dec 2020 04:00:18 +0000 (20:00 -0800)]
docs: Edit rustc_middle::middle::privacy

Add descriptions of `AccessLevel` and `AccessLevels`.

Add missing punctuation.

3 years agoUpdate books
Eric Huss [Tue, 22 Dec 2020 03:00:49 +0000 (19:00 -0800)]
Update books

3 years agoAuto merge of #80208 - bugadani:generics-of-alloc, r=matthewjasper
bors [Tue, 22 Dec 2020 00:20:14 +0000 (00:20 +0000)]
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.

3 years agorustc_span: Provide a reserved identifier check for a specific edition
Vadim Petrochenkov [Mon, 21 Dec 2020 18:59:57 +0000 (21:59 +0300)]
rustc_span: Provide a reserved identifier check for a specific edition

Edition evaluation is kept lazy because it may be expensive.

3 years agoRemove redundant test
Dániel Buga [Mon, 21 Dec 2020 16:40:39 +0000 (17:40 +0100)]
Remove redundant test

3 years agoAuto merge of #79270 - RalfJung:array-repeat-consts, r=oli-obk
bors [Mon, 21 Dec 2020 13:12:36 +0000 (13:12 +0000)]
Auto merge of #79270 - RalfJung:array-repeat-consts, r=oli-obk

Acknowledge that `[CONST; N]` is stable

When `const_in_array_repeat_expressions` (RFC 2203) got unstably implemented as part of https://github.com/rust-lang/rust/pull/61749, accidentally, the special case of repeating a *constant* got stabilized immediately. That is why the following code works on stable:

```rust
const EMPTY: Vec<i32> = Vec::new();

pub const fn bar() -> [Vec<i32>; 2] {
    [EMPTY; 2]
}

fn main() {
    let x = bar();
}
```

In contrast, if we had written `[expr; 2]` for some expression that is not *literally* a constant but could be evaluated at compile-time (e.g. `(EMPTY,).0`), this would have failed.

We could take back this stabilization as it was clearly accidental. However, I propose we instead just officially accept this and stabilize a small subset of RFC 2203, while leaving the more complex case of general expressions that could be evaluated at compile-time unstable. Making that case work well is pretty much blocked on inline `const` expressions (to avoid relying too much on [implicit promotion](https://github.com/rust-lang/const-eval/blob/master/promotion.md)), so it could take a bit until it comes to full fruition. `[CONST; N]` is an uncontroversial subset of this feature that has no semantic ambiguities, does not rely on promotion, and basically provides the full expressive power of RFC 2203 but without the convenience (people have to define constants to repeat them, possibly using associated consts if generics are involved).

Well, I said "no semantic ambiguities", that is only almost true... the one point I am not sure about is `[CONST; 0]`. There are two possible behaviors here: either this is equivalent to `let x = CONST; [x; 0]`, or it is a NOP (if we argue that the constant is never actually instantiated). The difference between the two is that if `CONST` has a destructor, it should run in the former case (but currently doesn't, due to https://github.com/rust-lang/rust/issues/74836); but should not run if it is considered a NOP. For regular `[x; 0]` there seems to be consensus on running drop (there isn't really an alternative); any opinions for the `CONST` special case? Should this instantiate the const only to immediately run its destructors? That seems somewhat silly to me. After all, the `let`-expansion does *not* work in general, for `N > 1`.

Cc `@rust-lang/lang` `@rust-lang/wg-const-eval`
Cc https://github.com/rust-lang/rust/issues/49147

3 years agoAuto merge of #80205 - tomprogrammer:prettyprint-pattern-mut-binding, r=davidtwco
bors [Mon, 21 Dec 2020 10:21:01 +0000 (10:21 +0000)]
Auto merge of #80205 - tomprogrammer:prettyprint-pattern-mut-binding, r=davidtwco

Fix pretty printing an AST representing `&(mut ident)`

The PR fixes a misguiding help diagnostic in the parser that I reported in #80186. I discovered that the parsers recovery and reporting logic was correct but the pretty printer produced wrong code for the example. (Details in https://github.com/rust-lang/rust/issues/80186#issuecomment-748498676)

Example:
```rust
#![allow(unused_variables)]
fn main() {
    let mut &x = &0;
}
```

The AST fragment

`PatKind::Ref(PatKind::Ident(BindingMode::ByValue(Mutability::Mut), ..), Mutability::Not)`

was printed to be `&mut ident`. But this wouldn't round trip through parsing again, because then it would be:

`PatKind::Ref(PatKind::Ident(BindingMode::ByValue(Mutability::Not), ..), Mutability::Mut)`

Now the pretty-printer prints `&(mut ident)`. Reparsing that code results in the AST fragment

`PatKind::Ref(PatKind::Paren(PatKind::Ident(BindingMode::ByValue(Mutability::Mut), ..)), Mutability::Not)`

which I think should behave like the original pattern.

Old diagnostic:
```
error: `mut` must be attached to each individual binding
 --> src/main.rs:3:9
  |
3 |     let mut &x = &0;
  |         ^^^^^^ help: add `mut` to each binding: `&mut x`
  |
  = note: `mut` may be followed by `variable` and `variable @ pattern`
```

New diagnostic:

```
error: `mut` must be attached to each individual binding
 --> src/main.rs:3:9
  |
3 |     let mut &x = &0;
  |         ^^^^^^ help: add `mut` to each binding: `&(mut x)`
  |
  = note: `mut` may be followed by `variable` and `variable @ pattern`
```

Fixes #80186

3 years agoAuto merge of #80206 - poliorcetics:rustdoc-default-langstring, r=GuillaumeGomez...
bors [Mon, 21 Dec 2020 07:00:17 +0000 (07:00 +0000)]
Auto merge of #80206 - poliorcetics:rustdoc-default-langstring, r=GuillaumeGomez,jyn514

impl Default for LangString, replacing all_false by default

Fix #80015

`@rustbot` label C-cleanup  T-rustdoc  A-markdown-parsing

3 years agoAuto merge of #80253 - Dylan-DPC:rollup-bkmn74z, r=Dylan-DPC
bors [Mon, 21 Dec 2020 04:08:35 +0000 (04:08 +0000)]
Auto merge of #80253 - Dylan-DPC:rollup-bkmn74z, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #80159 (Add array search aliases)
 - #80166 (Edit rustc_middle docs)
 - #80170 (Fix ICE when lookup method in trait for type that have bound vars)
 - #80171 (Edit rustc_middle::ty::TyKind docs)
 - #80199 (also const-check FakeRead)
 - #80211 (Handle desugaring in impl trait bound suggestion)
 - #80236 (Use pointer type in AtomicPtr::swap implementation)
 - #80239 (Update Clippy)
 - #80240 (make sure installer only creates directories in DESTDIR)
 - #80244 (Cleanup markdown span handling)
 - #80250 (Minor cleanups in LateResolver)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #80250 - bugadani:resolver-cleanup, r=petrochenkov
Dylan DPC [Mon, 21 Dec 2020 01:47:52 +0000 (02:47 +0100)]
Rollup merge of #80250 - bugadani:resolver-cleanup, r=petrochenkov

Minor cleanups in LateResolver

 - Avoid calculating hash twice
 - Avoid creating a closure in every iteration of a loop
 - Reserve space for path in advance
 - Some readability changes

3 years agoRollup merge of #80244 - jyn514:spans, r=bugadani
Dylan DPC [Mon, 21 Dec 2020 01:47:50 +0000 (02:47 +0100)]
Rollup merge of #80244 - jyn514:spans, r=bugadani

Cleanup markdown span handling

1. Get rid of `locate()` in markdown handling

This function was unfortunate for several reasons:

- It used `unsafe` because it wanted to tell whether a string came from
  the same *allocation* as another, not just whether it was a textual match.
- It recalculated spans even though they were already available from pulldown
- It sometimes *failed* to calculate the span, which meant it was always possible for the span to be `None`, even though in practice that should never happen.

This has several cleanups:

- Make the span required
- Pass through the span from pulldown in the `HeadingLinks` and `Footnotes` iterators
- Only add iterator bounds on the `impl Iterator`, not on `new` and the struct itself.

2. Remove unnecessary scope in `markdown_links`

I recommend reading a single commit at a time.

cc ``@bugadani`` - this will conflict with https://github.com/rust-lang/rust/pull/77859, I'll try to make sure that gets merged first.

3 years agoRollup merge of #80240 - yshui:master, r=Mark-Simulacrum
Dylan DPC [Mon, 21 Dec 2020 01:47:49 +0000 (02:47 +0100)]
Rollup merge of #80240 - yshui:master, r=Mark-Simulacrum

make sure installer only creates directories in DESTDIR

Fixes #80238

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
3 years agoRollup merge of #80239 - flip1995:clippyup, r=Manishearth
Dylan DPC [Mon, 21 Dec 2020 01:47:47 +0000 (02:47 +0100)]
Rollup merge of #80239 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update.

r? ``@Manishearth``

3 years agoRollup merge of #80236 - tmiasko:atomic-swap, r=oli-obk
Dylan DPC [Mon, 21 Dec 2020 01:47:45 +0000 (02:47 +0100)]
Rollup merge of #80236 - tmiasko:atomic-swap, r=oli-obk

Use pointer type in AtomicPtr::swap implementation

Closes #80234.

3 years agoRollup merge of #80211 - wabain:async-fn-trait-bound-suggestion, r=petrochenkov
Dylan DPC [Mon, 21 Dec 2020 01:47:44 +0000 (02:47 +0100)]
Rollup merge of #80211 - wabain:async-fn-trait-bound-suggestion, r=petrochenkov

Handle desugaring in impl trait bound suggestion

Fixes #79843.

When an associated type of a generic function parameter needs extra bounds, the diagnostics may suggest replacing an `impl Trait` with a named type parameter so that it can be referenced in the where clause. On stable and nightly, the suggestion can be malformed, for instance transforming:

```rust
async fn run(_: &(), foo: impl Foo) -> std::io::Result<()>
```

Into:

```rust
async fn run(_: &, F: Foo(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send
                 ^^^^^^^^         ^                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Where we want something like:

```rust
async fn run<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send
            ^^^^^^^^              ^                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

The problem is that the elided lifetime of `&()` is added as a generic parameter when desugaring the async fn; the suggestion code sees this as an existing generic parameter and tries to use its span as an anchor to inject `F` into the parameter list. There doesn't seem to be an entirely principled way to check which generic parameters in the HIR were explicitly named in the source, so this commit changes the heuristics when generating the suggestion to only consider type parameters whose spans are contained within the span of the `Generics` when determining how to insert an additional type parameter into the declaration. (And to be safe it also excludes parameters whose spans are marked as originating from desugaring, although that doesn't seem to handle this elided lifetime.)

3 years agoRollup merge of #80199 - RalfJung:const-fake, r=oli-obk
Dylan DPC [Mon, 21 Dec 2020 01:47:42 +0000 (02:47 +0100)]
Rollup merge of #80199 - RalfJung:const-fake, r=oli-obk

also const-check FakeRead

We need to const-check all statements, including `FakeRead`, to avoid issues like https://github.com/rust-lang/rust/issues/77694.

Fixes https://github.com/rust-lang/rust/issues/77694.
r? ``@oli-obk``

3 years agoRollup merge of #80171 - pierwill:pierwill-rustcmiddle-tykind, r=lcnr
Dylan DPC [Mon, 21 Dec 2020 01:47:41 +0000 (02:47 +0100)]
Rollup merge of #80171 - pierwill:pierwill-rustcmiddle-tykind, r=lcnr

Edit rustc_middle::ty::TyKind docs

- Add a definition for this enum.
- Fix typo and missing punctuation.
- Spell out "algebraic data type".

3 years agoRollup merge of #80170 - ldm0:fixice, r=lcnr
Dylan DPC [Mon, 21 Dec 2020 01:47:39 +0000 (02:47 +0100)]
Rollup merge of #80170 - ldm0:fixice, r=lcnr

Fix ICE when lookup method in trait for type that have bound vars

Closes #77910

3 years agoRollup merge of #80166 - pierwill:pierwill-rustcmiddle-place, r=petrochenkov
Dylan DPC [Mon, 21 Dec 2020 01:47:37 +0000 (02:47 +0100)]
Rollup merge of #80166 - pierwill:pierwill-rustcmiddle-place, r=petrochenkov

Edit rustc_middle docs

Re-word doc comment for rustc_middle::hir::place::Projection.

Also adds:

- Missing end stop punctuation, and
- Documentation links to `rustc_middle::mir::Place`.

3 years agoRollup merge of #80159 - jyn514:array, r=m-ou-se
Dylan DPC [Mon, 21 Dec 2020 01:47:33 +0000 (02:47 +0100)]
Rollup merge of #80159 - jyn514:array, r=m-ou-se

Add array search aliases

Missed this in https://github.com/rust-lang/rust/pull/80068. This one will really fix https://github.com/rust-lang/rust/issues/46075.

The last alias especially I'm a little unsure about - maybe fuzzy search should be fixed in rustdoc instead? Happy to make that change although I'd have to figure out how.

r? ``@m-ou-se`` although cc ``@GuillaumeGomez`` for the search issue.

3 years agoAuto merge of #80088 - operutka:fix-cmsg-len-uclibc, r=dtolnay
bors [Mon, 21 Dec 2020 01:16:20 +0000 (01:16 +0000)]
Auto merge of #80088 - operutka:fix-cmsg-len-uclibc, r=dtolnay

Fix failing build of std on armv5te-unknown-linux-uclibceabi due to missing cmsg_len_zero

I'm getting the following error when trying to build `std` on `armv5te-unknown-linux-uclibceabi`:

```
error[E0425]: cannot find value `cmsg_len_zero` in this scope
   --> /home/operutka/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/ext/net/ancillary.rs:376:47
    |
376 |             let data_len = (*cmsg).cmsg_len - cmsg_len_zero;
    |                                               ^^^^^^^^^^^^^ not found in this scope
```

Obviously, this branch:
```rust
cfg_if::cfg_if! {
    if #[cfg(any(target_os = "android", all(target_os = "linux", target_env = "gnu")))] {
        let cmsg_len_zero = libc::CMSG_LEN(0) as libc::size_t;
    } else if #[cfg(any(
                  target_os = "dragonfly",
                  target_os = "emscripten",
                  target_os = "freebsd",
                  all(target_os = "linux", target_env = "musl",),
                  target_os = "netbsd",
                  target_os = "openbsd",
              ))] {
        let cmsg_len_zero = libc::CMSG_LEN(0) as libc::socklen_t;
    }
}
```

does not cover the case `all(target_os = "linux", target_env = "uclibc")`.

3 years agoUpdate stdarch submodule
Tomasz Miąsko [Mon, 21 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Update stdarch submodule

3 years agoMove std_path construction into condition
Dániel Buga [Sun, 20 Dec 2020 22:55:03 +0000 (23:55 +0100)]
Move std_path construction into condition

3 years agoInline a single-use closure
Dániel Buga [Sun, 20 Dec 2020 22:17:56 +0000 (23:17 +0100)]
Inline a single-use closure

3 years agoRemove `I-prioritize` from Zulip topic
Camelid [Sun, 20 Dec 2020 22:08:55 +0000 (14:08 -0800)]
Remove `I-prioritize` from Zulip topic

It doesn't add anything since every topic in
`t-compiler/wg-prioritization/alerts` is about prioritization.
And it makes it harder to see the issue title, which is what the topic
is actually about.

3 years agoCreate closure outside of the loop
Dániel Buga [Sun, 20 Dec 2020 21:49:53 +0000 (22:49 +0100)]
Create closure outside of the loop

3 years agoFix incorrect logic when merging matches
Joshua Nelson [Sun, 20 Dec 2020 20:57:43 +0000 (15:57 -0500)]
Fix incorrect logic when merging matches

3 years agoAdd missing semicolon
Dániel Buga [Sun, 20 Dec 2020 20:41:35 +0000 (21:41 +0100)]
Add missing semicolon

3 years agoRemove unnecessary cloned
Dániel Buga [Sun, 20 Dec 2020 20:41:15 +0000 (21:41 +0100)]
Remove unnecessary cloned

3 years agoPrecompute vector length in smart_resolve_path_fragment
Dániel Buga [Sun, 20 Dec 2020 20:38:41 +0000 (21:38 +0100)]
Precompute vector length in smart_resolve_path_fragment

3 years agoClean up with_generic_param_rib, avoid double hashing
Dániel Buga [Sun, 20 Dec 2020 20:08:55 +0000 (21:08 +0100)]
Clean up with_generic_param_rib, avoid double hashing

3 years agoRemove unnecessary scope
Joshua Nelson [Sun, 20 Dec 2020 19:33:58 +0000 (14:33 -0500)]
Remove unnecessary scope