]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #77569 - ssomers:btree_cleanup_1, r=Mark-Simulacrum
Yuki Okushi [Tue, 13 Oct 2020 21:02:17 +0000 (06:02 +0900)]
Rollup merge of #77569 - ssomers:btree_cleanup_1, r=Mark-Simulacrum

BTreeMap: type-specific variants of node_as_mut and cast_unchecked

Improves debug checking and shortens some expressions. Extracted from #77408

3 years agoRollup merge of #77239 - shepmaster:silicon-ci-plus, r=pietroalbini
Yuki Okushi [Tue, 13 Oct 2020 21:02:12 +0000 (06:02 +0900)]
Rollup merge of #77239 - shepmaster:silicon-ci-plus, r=pietroalbini

Enable building Cargo for aarch64-apple-darwin

r? @ghost

3 years agoaarch64-apple-darwin now includes Cargo
Jake Goulding [Tue, 13 Oct 2020 15:00:03 +0000 (11:00 -0400)]
aarch64-apple-darwin now includes Cargo

3 years agoAuto merge of #75406 - mati865:mingw-aslr, r=Mark-Simulacrum
bors [Tue, 13 Oct 2020 14:12:08 +0000 (14:12 +0000)]
Auto merge of #75406 - mati865:mingw-aslr, r=Mark-Simulacrum

Enable ASLR for windows-gnu

Fixes https://github.com/rust-lang/rust/issues/16514
Fixes https://github.com/rust-lang/rust/issues/16593
Fixes https://github.com/rust-lang/rust/issues/17684

Passes the tests for me with x86_64 toolchain.

3 years agoAuto merge of #77762 - pietroalbini:dist-build-manifest, r=Mark-Simulacrum
bors [Tue, 13 Oct 2020 12:11:47 +0000 (12:11 +0000)]
Auto merge of #77762 - pietroalbini:dist-build-manifest, r=Mark-Simulacrum

Dist build manifest

This PR makes two changes that should remove a significant chunk of the time spent in our release process: cloning the `rust-lang/rust` monorepo, all its submodules, and building `bootstrap` to then invoke `build-manifest`:

* `build-manifest` doesn't rely on a clone of the monorepo being present anymore. The only remaining bit of information it fetched from it (the Rust version) is instead bundled in the binary.
* A new "component" is added, `build-manifest`. That component includes a prebuilt version of the tool, and it's *not* included in the Rustup manifest. This will allow `promote-release` to directly invoke the tool without interacting with our build system.
* The Linux x86_64 CI is changed to also build the component mentioned above. It's the only CI builder tasked to do so, and to cleanly support this a new `--include-default-paths` flag was added to `./x.py`.
* The `BUILD_MANIFEST_NUM_THREADS` environment variable is added to configure the number of threads at runtime.

This PR is best reviewed commit-by-commit.
r? `@Mark-Simulacrum`

3 years agoAuto merge of #77755 - bugadani:perf-calc-dtor, r=ecstatic-morse
bors [Tue, 13 Oct 2020 10:19:30 +0000 (10:19 +0000)]
Auto merge of #77755 - bugadani:perf-calc-dtor, r=ecstatic-morse

Monomorphize `calculate_dtor` instead of using function pointers

Change `calculate_dtor` to avoid dynamic dispatching. This change allows the empty functions to be optimized away.

Based on the discussion in https://github.com/rust-lang/rust/pull/77754#discussion_r502498970, the performance impact of this change was measured.

Perf run results: https://perf.rust-lang.org/compare.html?start=7bc5839e99411aad9061a632b62075d1346cbb3b&end=ffec759ae9bbc4d6d2235ff40ade6723a85bc7cc

3 years agoAuto merge of #77759 - tblah:fix_riscv_qemu, r=pietroalbini
bors [Tue, 13 Oct 2020 08:27:01 +0000 (08:27 +0000)]
Auto merge of #77759 - tblah:fix_riscv_qemu, r=pietroalbini

ci: Fix riscv64gc linux test QEMU fault, plus doc link fix

Newer versions of the `qemu` package (used for riscv64gc-unknown-linux-gnu testing) don't work with the version of the RISC-V bootloader we were using. https://github.com/rust-lang/rust/commit/a4a0342cf59a1bff43ed79586065eb97dba0cddb  bumps to a revision which should fix the problem.

https://github.com/rust-lang/rust/commit/e0b033e965a7d422da70a409a028af7c8b64e709 fixes a documentation failure I encountered while running the tests.

3 years agoAuto merge of #77639 - jagill:stabilize-slice_partition_at_index, r=Amanieu
bors [Tue, 13 Oct 2020 06:33:52 +0000 (06:33 +0000)]
Auto merge of #77639 - jagill:stabilize-slice_partition_at_index, r=Amanieu

Stabilize slice_partition_at_index

This stabilizes slice_partition_at_index, including renaming `partition_at_index*` -> `select_nth_unstable*`.

Closes #55300

r? `@Amanieu`

3 years agoAuto merge of #76196 - r-52:r-coverage-allow-missing-docs, r=jyn514
bors [Tue, 13 Oct 2020 04:41:08 +0000 (04:41 +0000)]
Auto merge of #76196 - r-52:r-coverage-allow-missing-docs, r=jyn514

rustdoc: skip #[allow(missing docs)] for docs in coverage report

During the document coverage reporting with:
```bash
rustdoc something.rs -Z unstable-options --show-coverage
```

the coverage report counts code that is marked with `#[allow(missing_docs)]` for the calculation, which outputs lower numbers in the coverage report even though these parts should be ignored for the calculation.

Right now I'm not sure how this can be tested (CI)? (I verified it by hand and ran the unit tests)

r? `@jyn514`

**Reference:** Fixes #76121

3 years agoAuto merge of #76830 - Artoria2e5:tune, r=nagisa
bors [Tue, 13 Oct 2020 02:49:00 +0000 (02:49 +0000)]
Auto merge of #76830 - Artoria2e5:tune, r=nagisa

Pass tune-cpu to LLVM

I think this is how it should work...

See https://internals.rust-lang.org/t/expose-tune-cpu-from-llvm/13088 for the background. Or the documentation diff.

3 years agoAuto merge of #77796 - jonas-schievink:switchint-refactor, r=oli-obk
bors [Tue, 13 Oct 2020 00:57:03 +0000 (00:57 +0000)]
Auto merge of #77796 - jonas-schievink:switchint-refactor, r=oli-obk

Refactor how SwitchInt stores jump targets

Closes https://github.com/rust-lang/rust/issues/65693

3 years agoAuto merge of #77792 - matthewjasper:instrument-trait-selection, r=oli-obk
bors [Mon, 12 Oct 2020 23:04:55 +0000 (23:04 +0000)]
Auto merge of #77792 - matthewjasper:instrument-trait-selection, r=oli-obk

Use tracing spans in rustc_trait_selection

Spans are very helpful when debugging this code. It's also hot enough to make a good benchmark.

r? `@oli-obk`

3 years agoAuto merge of #77847 - Xanewok:update-rls, r=Xanewok
bors [Mon, 12 Oct 2020 21:03:35 +0000 (21:03 +0000)]
Auto merge of #77847 - Xanewok:update-rls, r=Xanewok

Update RLS

cc #77819
Fixes #77810

r? `@ghost`

3 years agoConfigure jemalloc for cross-compilation to aarch64-apple-darwin
Jake Goulding [Sun, 27 Sep 2020 17:27:29 +0000 (13:27 -0400)]
Configure jemalloc for cross-compilation to aarch64-apple-darwin

3 years agoAuto merge of #77867 - JohnTitor:rollup-0odg1n4, r=JohnTitor
bors [Mon, 12 Oct 2020 19:09:08 +0000 (19:09 +0000)]
Auto merge of #77867 - JohnTitor:rollup-0odg1n4, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #77550 (add shims for WithOptConstParam query calls)
 - #77699 (Add word wrap for short descriptions)
 - #77724 (Implement `AsRawFd` for `StdinLock` etc. on WASI.)
 - #77746 (Fix `x.py setup` sets `changelog-seen`)
 - #77784 (Fix intra-docs link in core::ffi::VaList)
 - #77811 (rustdoc: Make some functions private that don't need to be public)
 - #77818 (Mono collector: replace pair of ints with Range)
 - #77831 (Use std methods on char instead of open coding them)
 - #77852 (update url in bootstrap README (gcc-rs -> cc-rs))
 - #77863 (Remove `mark-i-m` from rustc-dev-guide maintainers)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77863 - JohnTitor:remove-mark-i-m, r=pietroalbini
Yuki Okushi [Mon, 12 Oct 2020 19:08:07 +0000 (04:08 +0900)]
Rollup merge of #77863 - JohnTitor:remove-mark-i-m, r=pietroalbini

Remove `mark-i-m` from rustc-dev-guide maintainers

They aren't a maintainer anymore and it causes failure on our CI now: https://github.com/rust-lang-ci/rust/runs/1243600577

3 years agoRollup merge of #77852 - 12101111:fix-bootstrap-doc, r=jonas-schievink
Yuki Okushi [Mon, 12 Oct 2020 19:08:05 +0000 (04:08 +0900)]
Rollup merge of #77852 - 12101111:fix-bootstrap-doc, r=jonas-schievink

update url in bootstrap README (gcc-rs -> cc-rs)

gcc-rs is renamed to cc-rs 3 years ago.

3 years agoRollup merge of #77831 - LingMan:use_std, r=jonas-schievink
Yuki Okushi [Mon, 12 Oct 2020 19:08:03 +0000 (04:08 +0900)]
Rollup merge of #77831 - LingMan:use_std, r=jonas-schievink

Use std methods on char instead of open coding them

3 years agoRollup merge of #77818 - bugadani:range, r=oli-obk
Yuki Okushi [Mon, 12 Oct 2020 19:08:02 +0000 (04:08 +0900)]
Rollup merge of #77818 - bugadani:range, r=oli-obk

Mono collector: replace pair of ints with Range

I found the initial PR (#33171) that introduced this piece of code but I didn't find any information about why a tuple was preferred over a `Range<usize>`.

I'm hoping there are no technical reasons to not do this.

3 years agoRollup merge of #77811 - jyn514:private, r=GuillaumeGomez
Yuki Okushi [Mon, 12 Oct 2020 19:08:00 +0000 (04:08 +0900)]
Rollup merge of #77811 - jyn514:private, r=GuillaumeGomez

rustdoc: Make some functions private that don't need to be public

r? @GuillaumeGomez

3 years agoRollup merge of #77784 - aDotInTheVoid:ffi-sealed_trait-intra-docs, r=jyn514
Yuki Okushi [Mon, 12 Oct 2020 19:07:58 +0000 (04:07 +0900)]
Rollup merge of #77784 - aDotInTheVoid:ffi-sealed_trait-intra-docs, r=jyn514

Fix intra-docs link in core::ffi::VaList

At some point, `VaList` was changes to be a [wrapper](https://github.com/rust-lang/rust/blob/1661f77/library/core/src/ffi.rs#L177-L201) over `VaListImpl`, and now the `Arg` method exists on [`VaListImpl`](https://github.com/rust-lang/rust/blob/1661f77/library/core/src/ffi.rs#L333-L336). This PR fixes the intradoc links so that when `--document-private-items` is ran on std (via [patch](https://gist.github.com/aDotInTheVoid/42c82306210203f9c9093c952b765ab4)), it works

3 years agoRollup merge of #77746 - winnayx:issue-77572-fix, r=jyn514
Yuki Okushi [Mon, 12 Oct 2020 19:07:56 +0000 (04:07 +0900)]
Rollup merge of #77746 - winnayx:issue-77572-fix, r=jyn514

Fix `x.py setup` sets `changelog-seen`

Fixes #77572 by setting changelog-seen in setup.rs

3 years agoRollup merge of #77724 - sunfishcode:stdinlock-asrawfd, r=alexcrichton
Yuki Okushi [Mon, 12 Oct 2020 19:07:54 +0000 (04:07 +0900)]
Rollup merge of #77724 - sunfishcode:stdinlock-asrawfd, r=alexcrichton

Implement `AsRawFd` for `StdinLock` etc. on WASI.

WASI implements `AsRawFd` for `Stdin`, `Stdout`, and `Stderr`, so
implement it for `StdinLock`, `StdoutLock`, and `StderrLock` as well.

r? @alexcrichton

3 years agoRollup merge of #77699 - GuillaumeGomez:word-wrap, r=XAMPPRocky
Yuki Okushi [Mon, 12 Oct 2020 19:07:52 +0000 (04:07 +0900)]
Rollup merge of #77699 - GuillaumeGomez:word-wrap, r=XAMPPRocky

Add word wrap for short descriptions

Fixes #77652

![Screenshot from 2020-10-08 13-26-18](https://user-images.githubusercontent.com/3050060/95452770-11845280-096a-11eb-80da-723da85261fa.png)

cc @WaffleLapkin
r? @jyn514

3 years agoRollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morse
Yuki Okushi [Mon, 12 Oct 2020 19:07:50 +0000 (04:07 +0900)]
Rollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morse

add shims for WithOptConstParam query calls

r? @ecstatic-morse @eddyb

3 years agoRemove `mark-i-m` from rustc-dev-guide maintainers
Yuki Okushi [Mon, 12 Oct 2020 18:13:00 +0000 (03:13 +0900)]
Remove `mark-i-m` from rustc-dev-guide maintainers

3 years agoEnable building Cargo for aarch64-apple-darwin
Jake Goulding [Sat, 26 Sep 2020 13:42:04 +0000 (09:42 -0400)]
Enable building Cargo for aarch64-apple-darwin

3 years agoUpgrade OpenSSL to 1.1.1h and add support for aarch64-apple-darwin
Jake Goulding [Mon, 12 Oct 2020 17:56:07 +0000 (13:56 -0400)]
Upgrade OpenSSL to 1.1.1h and add support for aarch64-apple-darwin

3 years agobuild-manifest: bundle the rustc version in the binary
Pietro Albini [Mon, 12 Oct 2020 17:40:35 +0000 (19:40 +0200)]
build-manifest: bundle the rustc version in the binary

3 years agobuild-manifest: use var_os instead of var to check if vars exist
Pietro Albini [Mon, 12 Oct 2020 17:34:01 +0000 (19:34 +0200)]
build-manifest: use var_os instead of var to check if vars exist

This will prevent the tool mistakenly ignoring the variables if they
happen to contain non-utf8 data.

3 years agobuild-manifest: allow configuring the number of threads
Pietro Albini [Mon, 12 Oct 2020 15:47:37 +0000 (17:47 +0200)]
build-manifest: allow configuring the number of threads

3 years agoci: also build the build-manifest component on dist-x86_64-linux
Pietro Albini [Fri, 9 Oct 2020 17:53:48 +0000 (19:53 +0200)]
ci: also build the build-manifest component on dist-x86_64-linux

3 years agobootstrap: add --include-default-paths to ./x.py
Pietro Albini [Fri, 9 Oct 2020 17:51:07 +0000 (19:51 +0200)]
bootstrap: add --include-default-paths to ./x.py

3 years agobootstrap: add disabled by default build-manifest dist component
Pietro Albini [Fri, 9 Oct 2020 17:49:13 +0000 (19:49 +0200)]
bootstrap: add disabled by default build-manifest dist component

3 years agobuild-manifest: accept the Rust version instead of the monorepo path
Pietro Albini [Fri, 9 Oct 2020 13:34:57 +0000 (15:34 +0200)]
build-manifest: accept the Rust version instead of the monorepo path

This commit changes the way build-manifest is invoked, to let it accept
the Rust version directly instead of requiring the path of the Rust
monorepo and letting build-manifest figure out the path on its own.

This allows to run build-manifest without a clone of the monorepo.

3 years agoAuto merge of #77854 - pietroalbini:ETOOMANYCHANNELS, r=Mark-Simulacrum
bors [Mon, 12 Oct 2020 15:50:36 +0000 (15:50 +0000)]
Auto merge of #77854 - pietroalbini:ETOOMANYCHANNELS, r=Mark-Simulacrum

build-manifest: stop generating numbered channel names except for stable

This fixes numbered channel names being created for the nightly channel, and once the root cause of this rides the trains, for beta.

r? `@Mark-Simulacrum`

3 years agobuild-manifest: stop generating numbered channel names except for stable
Pietro Albini [Mon, 12 Oct 2020 15:39:13 +0000 (17:39 +0200)]
build-manifest: stop generating numbered channel names except for stable

This fixes numbered channel names being created for the nightly channel,
and once the root cause of this rides the trains, for beta.

3 years agoAdd word-wrap rule for short descriptions
Guillaume Gomez [Thu, 8 Oct 2020 11:25:36 +0000 (13:25 +0200)]
Add word-wrap rule for short descriptions

3 years agoupdate url in bootstrap README
12101111 [Mon, 12 Oct 2020 13:17:11 +0000 (21:17 +0800)]
update url in bootstrap README

3 years agoExtend test to ensure that items inherit lint level from the parent
Guillaume Gomez [Mon, 12 Oct 2020 12:32:41 +0000 (14:32 +0200)]
Extend test to ensure that items inherit lint level from the parent

3 years agoAuto merge of #77821 - tmiasko:discriminant-value-is-safe, r=jonas-schievink
bors [Mon, 12 Oct 2020 12:12:54 +0000 (12:12 +0000)]
Auto merge of #77821 - tmiasko:discriminant-value-is-safe, r=jonas-schievink

Remove unnecessary unsafe block around calls to discriminant_value

Since 63793 the discriminant_value intrinsic is safe to call. Remove
unnecessary unsafe block around calls to this intrinsic in built-in
derive macros.

3 years agoImprove lint level handling
Guillaume Gomez [Mon, 12 Oct 2020 11:48:45 +0000 (13:48 +0200)]
Improve lint level handling

3 years agoApply same treatment to MISSING_DOC_CODE_EXAMPLES
Guillaume Gomez [Thu, 8 Oct 2020 16:20:00 +0000 (18:20 +0200)]
Apply same treatment to MISSING_DOC_CODE_EXAMPLES

3 years agoInherit lint level from parents
Guillaume Gomez [Thu, 8 Oct 2020 16:05:01 +0000 (18:05 +0200)]
Inherit lint level from parents

3 years agorustdoc: skip allow missing doc in cover. report
Roman [Tue, 1 Sep 2020 12:19:24 +0000 (14:19 +0200)]
rustdoc: skip allow missing doc in cover. report

During the document coverage reporting with
```bash
rustdoc something.rs -Z unstable-options --show-coverage
```

the coverage report also includes parts of the code that are marked
with `#[allow(missing_docs)]`, which outputs lower numbers in the
coverage report even though these parts should be ignored for the
calculation.

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoUpdate RLS
Igor Matuszewski [Mon, 12 Oct 2020 11:10:43 +0000 (13:10 +0200)]
Update RLS

3 years agoAuto merge of #75914 - arlosi:aarch64-ci, r=pietroalbini
bors [Mon, 12 Oct 2020 10:17:48 +0000 (10:17 +0000)]
Auto merge of #75914 - arlosi:aarch64-ci, r=pietroalbini

Promote aarch64-pc-windows-msvc to Tier 2 Development Platform

Adds a GitHub Actions CI build for `aarch64-pc-windows-msvc` via cross-compilation on an x86_64 host.

This promotes `aarch64-pc-windows-msvc` from a Tier 2 Compilation Target (std) to a Tier 2 Development Platform (std+rustc+cargo+tools).

Fixes #72881

r? `@pietroalbini`

3 years agoAuto merge of #77837 - Aaron1011:bump-miri-backtrace, r=RalfJung
bors [Mon, 12 Oct 2020 08:25:38 +0000 (08:25 +0000)]
Auto merge of #77837 - Aaron1011:bump-miri-backtrace, r=RalfJung

Bump miri

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

r? `@RalfJung`

3 years agoAuto merge of #75956 - jonas-schievink:lto-opt-sz, r=tmiasko
bors [Mon, 12 Oct 2020 06:10:50 +0000 (06:10 +0000)]
Auto merge of #75956 - jonas-schievink:lto-opt-sz, r=tmiasko

Fix -Clinker-plugin-lto with opt-levels s and z

Pass s and z as `-plugin-opt=O2` to the linker. This is what `-Os` and `-Oz` correspond to, apparently.

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

3 years agoAuto merge of #77819 - mati865:crossbeam-ub, r=Mark-Simulacrum
bors [Mon, 12 Oct 2020 04:18:56 +0000 (04:18 +0000)]
Auto merge of #77819 - mati865:crossbeam-ub, r=Mark-Simulacrum

Update crossbeam-channel to avoid UB

More info: https://github.com/RustSec/advisory-db/pull/425

3 years agoStabilize slice_select_nth_unstable
James Gill [Wed, 7 Oct 2020 01:54:05 +0000 (21:54 -0400)]
Stabilize slice_select_nth_unstable

This stabilizes the functionality in slice_partition_at_index,
but under the names `select_nth_unstable*`.  The functions
`partition_at_index*` are left as deprecated, to be removed in
a later release.

Closes #55300

3 years agoAuto merge of #77790 - jyn514:undivided, r=ollie27
bors [Mon, 12 Oct 2020 02:20:04 +0000 (02:20 +0000)]
Auto merge of #77790 - jyn514:undivided, r=ollie27

Show summary lines on cross-crate re-exports

See my write-up in https://github.com/rust-lang/rust/issues/77783#issuecomment-706551743 for what's going on here.

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

r? `@ollie27`

3 years agoRemove unnecessary `RefCell` for doc_strings
Joshua Nelson [Mon, 12 Oct 2020 00:31:00 +0000 (20:31 -0400)]
Remove unnecessary `RefCell` for doc_strings

This was there for `Divider` and is no longer necessary.

3 years agoShow summary lines on cross-crate re-exports
Joshua Nelson [Mon, 12 Oct 2020 00:27:17 +0000 (20:27 -0400)]
Show summary lines on cross-crate re-exports

This removes the unnecessary `DocFragmentKind::Divider` in favor of just
using the logic I actually want in `collapse_docs`.

3 years agoUse no-prefer-dynamic
Jonas Schievink [Sun, 11 Oct 2020 23:51:40 +0000 (01:51 +0200)]
Use no-prefer-dynamic

3 years agoBump miri
Aaron Hill [Sun, 11 Oct 2020 22:09:27 +0000 (18:09 -0400)]
Bump miri

3 years agoFix -Clinker-plugin-lto with opt-levels s and z
Jonas Schievink [Wed, 26 Aug 2020 20:11:53 +0000 (22:11 +0200)]
Fix -Clinker-plugin-lto with opt-levels s and z

3 years agoAuto merge of #75991 - shepmaster:silicon-ci, r=pietroalbini
bors [Sun, 11 Oct 2020 23:23:48 +0000 (23:23 +0000)]
Auto merge of #75991 - shepmaster:silicon-ci, r=pietroalbini

Set up CI for aarch64-apple-darwin

3 years agoUpdate crossbeam-channel to avoid UB
Mateusz Mikuła [Sun, 11 Oct 2020 14:19:35 +0000 (16:19 +0200)]
Update crossbeam-channel to avoid UB

3 years agoAuto merge of #76859 - Aaron1011:fix/llvm-cgu-reuse, r=davidtwco,nikic
bors [Sun, 11 Oct 2020 20:50:02 +0000 (20:50 +0000)]
Auto merge of #76859 - Aaron1011:fix/llvm-cgu-reuse, r=davidtwco,nikic

Use llvm::computeLTOCacheKey to determine post-ThinLTO CGU reuse

During incremental ThinLTO compilation, we attempt to re-use the
optimized (post-ThinLTO) bitcode file for a module if it is 'safe' to do
so.

Up until now, 'safe' has meant that the set of modules that our current
modules imports from/exports to is unchanged from the previous
compilation session. See PR #67020 and PR #71131 for more details.

However, this turns out be insufficient to guarantee that it's safe
to reuse the post-LTO module (i.e. that optimizing the pre-LTO module
would produce the same result). When LLVM optimizes a module during
ThinLTO, it may look at other information from the 'module index', such
as whether a (non-imported!) global variable is used. If this
information changes between compilation runs, we may end up re-using an
optimized module that (for example) had dead-code elimination run on a
function that is now used by another module.

Fortunately, LLVM implements its own ThinLTO module cache, which is used
when ThinLTO is performed by a linker plugin (e.g. when clang is used to
compile a C proect). Using this cache directly would require extensive
refactoring of our code - but fortunately for us, LLVM provides a
function that does exactly what we need.

The function `llvm::computeLTOCacheKey` is used to compute a SHA-1 hash
from all data that might influence the result of ThinLTO on a module.
In addition to the module imports/exports that we manually track, it
also hashes information about global variables (e.g. their liveness)
which might be used during optimization. By using this function, we
shouldn't have to worry about new LLVM passes breaking our module re-use
behavior.

In LLVM, the output of this function forms part of the filename used to
store the post-ThinLTO module. To keep our current filename structure
intact, this PR just writes out the mapping 'CGU name -> Hash' to a
file. To determine if a post-LTO module should be reused, we compare
hashes from the previous session.

This should unblock PR #75199 - by sheer chance, it seems to have hit
this issue due to the particular CGU partitioning and optimization
decisions that end up getting made.

3 years agoMostly print statements to see where things are
Winnie Xiao [Tue, 6 Oct 2020 21:20:51 +0000 (23:20 +0200)]
Mostly print statements to see where things are

More print statementsstatements lol

Solved the basic case of eliminating check_version ifk_version if subcommand = setup

Finished v1

checking out old bootstrap.py

checked out old irrelevant files

fixed tidy

Moved VERSION from bin/main.rs to lib.rs

Fixed semicolon return issue

x.py fmt

3 years agoSimplify using is_ascii_alphabetic and is_ascii_alphanumeric
LingMan [Wed, 23 Sep 2020 04:49:42 +0000 (06:49 +0200)]
Simplify using is_ascii_alphabetic and is_ascii_alphanumeric

3 years agoDon't duplicate char::is_ascii_digit
LingMan [Wed, 23 Sep 2020 03:39:22 +0000 (05:39 +0200)]
Don't duplicate char::is_ascii_digit

3 years agoAuto merge of #77824 - Aaron1011:bump-backtrace-miri, r=RalfJung
bors [Sun, 11 Oct 2020 18:24:40 +0000 (18:24 +0000)]
Auto merge of #77824 - Aaron1011:bump-backtrace-miri, r=RalfJung

Bump backtrace-rs

Fixes #77791

r? `@RalfJung`

cc `@alexcrichton`

3 years agoBump backtrace-rs
Aaron Hill [Sun, 11 Oct 2020 17:51:07 +0000 (13:51 -0400)]
Bump backtrace-rs

Fixes #77791

3 years agoAuto merge of #77793 - tmiasko:no-op-discriminant, r=ecstatic-morse
bors [Sun, 11 Oct 2020 16:33:47 +0000 (16:33 +0000)]
Auto merge of #77793 - tmiasko:no-op-discriminant, r=ecstatic-morse

Recognize discriminant reads as no-ops in RemoveNoopLandingPads

The cleanup blocks often contain read of discriminants. Teach
RemoveNoopLandingPads to recognize them as no-ops to remove
additional no-op landing pads.

3 years agoMake some functions private that don't need to be public
Joshua Nelson [Sun, 11 Oct 2020 03:50:45 +0000 (23:50 -0400)]
Make some functions private that don't need to be public

3 years agoUse tracing spans in rustc_trait_selection
Matthew Jasper [Sun, 11 Oct 2020 10:37:56 +0000 (11:37 +0100)]
Use tracing spans in rustc_trait_selection

3 years agoAuto merge of #77727 - thomcc:mach-info-order, r=Amanieu
bors [Sun, 11 Oct 2020 14:06:04 +0000 (14:06 +0000)]
Auto merge of #77727 - thomcc:mach-info-order, r=Amanieu

Avoid SeqCst or static mut in mach_timebase_info and QueryPerformanceFrequency caches

This patch went through a couple iterations but the end result is replacing a pattern where an `AtomicUsize` (updated with many SeqCst ops) guards a `static mut` with a single `AtomicU64` that is known to use 0 as a value indicating that it is not initialized.

The code in both places exists to cache values used in the conversion of Instants to Durations on macOS, iOS, and Windows.

I have no numbers to prove that this improves performance (It seems a little futile to benchmark something like this), but it's much simpler, safer, and in practice we'd expect it to be faster everywhere where Relaxed operations on AtomicU64 are cheaper than SeqCst operations on AtomicUsize, which is a lot of places.

Anyway, it also removes a bunch of unsafe code and greatly simplifies the logic, so IMO that alone would be worth it unless it was a regression.

If you want to take a look at the assembly output though, see https://godbolt.org/z/rbr6vn for x86_64, https://godbolt.org/z/cqcbqv for aarch64 (Note that this just the output of the mac side, but i'd expect the windows part to be the same and don't feel like doing another godbolt for it). There are several versions of this function in the godbolt:

- `info_new`: version in the current patch
- `info_less_new`: version in initial PR
- `info_original`: version currently in the tree
- `info_orig_but_better_orderings`: a version that just tries to change the original code's orderings from SeqCst to the (probably) minimal orderings required for soundness/correctness.

The biggest concern I have here is if we can use AtomicU64, or if there are targets that dont have it that this code supports. AFAICT: no. (If that changes in the future, it's easy enough to do something different for them)

r? `@Amanieu` because he caught a couple issues last time I tried to do a patch reducing orderings 😅

---

<details>
<summary>I rewrote this whole message so the original is inside here</summary>

I happened to notice the code we use for caching the result of mach_timebase_info uses SeqCst exclusively.

However, thinking a little more, it's actually pretty easy to avoid the static mut by packing the timebase info into an AtomicU64.

This entirely avoids needing to do the compare_exchange. The AtomicU64 can be read/written using Relaxed ops, which on current macos/ios platforms (x86_64/aarch64) have no overhead compared to direct loads/stores. This simplifies the code and makes it a lot safer too.

I have no numbers to prove that this improves performance (It seems a little futile to benchmark something like this), although it should do that on both targets it applies to.

That said, it also removes a bunch of unsafe code and simplifies the logic (arguably at least — there are only two states now, initialized or not), so I think it's a net win even without concrete numbers.

If you want to take a look at the assembly output though, see below. It has the new version, the original, and a version of the original with lower Orderings (which is still worse than the version in this PR)

- godbolt.org/z/obfqf9 x86_64-apple-darwin

- godbolt.org/z/Wz5cWc aarch64-unknown-linux-gnu (godbolt can't do aarch64-apple-ios but that doesn't matter here)

A different (and more efficient) option than this would be to just use the AtomicU64 and use the knowledge that after initialization the denominator should be nonzero... That felt like it's relying on too many things I'm not confident in, so I didn't want to do that.
</details>

3 years agoAuto merge of #77743 - bugadani:idl-cleanup, r=bugadani
bors [Sun, 11 Oct 2020 09:50:19 +0000 (09:50 +0000)]
Auto merge of #77743 - bugadani:idl-cleanup, r=bugadani

Clean up in intra-doc link collector

This PR makes the following changes in intra-doc links:
 - clean up hard to follow closure-based logic in `check_full_res`
 - fix a FIXME comment by figuring out that `true` and `false` need to be resolved separately
 - refactor path resolution by extracting common code to a helper method and trying to reduce the number of unnecessary early returns
 - primitive types are now defined by their symbols, not their name strings
 - re-enables a commented-out test case

Closes #77267 (cc `@Stupremee)`

r? `@jyn514`

3 years agoAuto merge of #77769 - camelid:regression-untriaged, r=jyn514
bors [Sun, 11 Oct 2020 07:55:20 +0000 (07:55 +0000)]
Auto merge of #77769 - camelid:regression-untriaged, r=jyn514

Auto-prioritize issues with `regression-untriaged`

This auto-prioritizes issues with the `regression-untriaged` label. (I just added it per <https://github.com/rust-lang/rust/pull/77725#discussion_r502135703>.)

Cc #77725

r? `@Mark-Simulacrum`

3 years agoAuto merge of #77565 - khyperia:codegen-backend-dep, r=ecstatic-morse
bors [Sun, 11 Oct 2020 06:03:23 +0000 (06:03 +0000)]
Auto merge of #77565 - khyperia:codegen-backend-dep, r=ecstatic-morse

Add -Z codegen-backend dylib to deps

When the codegen-backend dylib changes, the program should be rebuilt.

---

Unfortunately I was unable to test this works locally due to running into a TLS issue when running the custom backend, `thread 'rustc' panicked at 'no ImplicitCtxt stored in tls', compiler/rustc_middle/src/ty/context.rs:1750:54`, which seems similar to https://github.com/rust-lang/rust/issues/62717 but has a completely different cause and backtrace.

`@eddyb` said to ping `@Mark-Simulacrum` about what they think about this, so, ping!

3 years agoAuto merge of #77774 - petrochenkov:floatuple, r=estebank
bors [Sun, 11 Oct 2020 03:54:26 +0000 (03:54 +0000)]
Auto merge of #77774 - petrochenkov:floatuple, r=estebank

rustc_parse: More precise spans for `tuple.0.0`

This should help with https://github.com/rust-lang/rustfmt/issues/4355, but I haven't verified, cc `@calebcartwright.`

3 years agoAuto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper
bors [Sun, 11 Oct 2020 01:26:06 +0000 (01:26 +0000)]
Auto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasper

Replace run_compiler with RunCompiler builder pattern

Fixes #77286. Replaces rustc_driver:run_compiler with RunCompiler builder pattern.

3 years agoRemove unnecessary unsafe block around calls to discriminant_value
Tomasz Miąsko [Sun, 11 Oct 2020 00:00:00 +0000 (00:00 +0000)]
Remove unnecessary unsafe block around calls to discriminant_value

Since 63793 the discriminant_value intrinsic is safe to call. Remove
unnecessary unsafe block around calls to this intrinsic in built-in
derive macros.

3 years agorustc_parse: More precise spans for `tuple.0.0`
Vadim Petrochenkov [Fri, 9 Oct 2020 23:01:44 +0000 (02:01 +0300)]
rustc_parse: More precise spans for `tuple.0.0`

3 years agoAuto merge of #77087 - estebank:issue-45817, r=matthewjasper
bors [Sat, 10 Oct 2020 23:27:28 +0000 (23:27 +0000)]
Auto merge of #77087 - estebank:issue-45817, r=matthewjasper

Provide structured suggestions when finding structs when expecting a trait

When finding an ADT in a trait object definition provide some solutions. Fix #45817.
Given `<Param as Trait>::Assoc: Ty` suggest `Param: Trait<Assoc = Ty>`. Fix #75829.

3 years agoUse SmallVec in SwitchTargets
Jonas Schievink [Sat, 10 Oct 2020 23:14:12 +0000 (01:14 +0200)]
Use SmallVec in SwitchTargets

This allows building common SwitchTargets (eg. for `if`s) without
allocation.

3 years agoAuto merge of #76934 - camelid:rustdoc-allow-generic-params, r=jyn514
bors [Sat, 10 Oct 2020 21:19:50 +0000 (21:19 +0000)]
Auto merge of #76934 - camelid:rustdoc-allow-generic-params, r=jyn514

Allow generic parameters in intra-doc links

Fixes #62834.

---

The contents of the generics will be mostly ignored (except for warning
if fully-qualified syntax is used, which is currently unsupported in
intra-doc links - see issue #74563).

* Allow links like `Vec<T>`, `Result<T, E>`, and `Option<Box<T>>`
* Allow links like `Vec::<T>::new()`
* Warn on
  * Unbalanced angle brackets (e.g. `Vec<T` or `Vec<T>>`)
  * Missing type to apply generics to (`<T>` or `<Box<T>>`)
  * Use of fully-qualified syntax (`<Vec as IntoIterator>::into_iter`)
  * Invalid path separator (`Vec:<T>:new`)
  * Too many angle brackets (`Vec<<T>>`)
  * Empty angle brackets (`Vec<>`)

Note that this implementation *does* allow some constructs that aren't
valid in the actual Rust syntax, for example `Box::<T>new()`. That may
not be supported in rustdoc in the future; it is an implementation
detail.

3 years agoUse range instead of tuple of ints
Dániel Buga [Sat, 10 Oct 2020 20:33:22 +0000 (22:33 +0200)]
Use range instead of tuple of ints

3 years agoFix query docs
Camelid [Sat, 10 Oct 2020 19:49:31 +0000 (12:49 -0700)]
Fix query docs

They were not formatted correctly, so rustdoc was interpreting some
parts as code. Also cleaned up some other query docs that weren't
causing issues, but were formatted incorrectly.

3 years agoAuto merge of #77798 - JohnTitor:rollup-82u711m, r=JohnTitor
bors [Sat, 10 Oct 2020 19:26:13 +0000 (19:26 +0000)]
Auto merge of #77798 - JohnTitor:rollup-82u711m, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #77195 (Link to documentation-specific guidelines.)
 - #77629 (Cleanup of `eat_while()` in lexer)
 - #77709 (Link Vec leak doc to Box)
 - #77738 (fix __rust_alloc_error_handler comment)
 - #77748 (Dead code cleanup in windows-gnu std)
 - #77754 (Add TraitDef::find_map_relevant_impl)
 - #77766 (Clarify the debug-related values should take boolean)
 - #77777 (doc: disambiguate stat in MetadataExt::as_raw_stat)
 - #77782 (Fix typo in error code description)
 - #77787 (Update `changelog-seen` in config.toml.example)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77787 - jyn514:consistent-versions, r=spastorino
Yuki Okushi [Sat, 10 Oct 2020 18:19:21 +0000 (03:19 +0900)]
Rollup merge of #77787 - jyn514:consistent-versions, r=spastorino

Update `changelog-seen` in config.toml.example

This got out of sync when the version was bumped last time in #77133

Long-term we may want to find an easier way to maintain this that
doesn't require bumping the version in three different places. Off the
top of my head I can't think of anything, though. It _is_ documented in src/bootstrap/README.md, although I don't know how many people read that.

r? @Mark-Simulacrum
cc @spastorino

3 years agoRollup merge of #77782 - nhayama:fix-typo, r=jonas-schievink
Yuki Okushi [Sat, 10 Oct 2020 18:19:19 +0000 (03:19 +0900)]
Rollup merge of #77782 - nhayama:fix-typo, r=jonas-schievink

Fix typo in error code description

s/abitrary/arbitrary/

3 years agoRollup merge of #77777 - cuviper:doc-stat, r=jonas-schievink
Yuki Okushi [Sat, 10 Oct 2020 18:19:18 +0000 (03:19 +0900)]
Rollup merge of #77777 - cuviper:doc-stat, r=jonas-schievink

doc: disambiguate stat in MetadataExt::as_raw_stat

A few architectures in `os::linux::raw` import `libc::stat`, rather than
defining that type directly. However, that also imports the _function_
called `stat`, which makes this doc link ambiguous:

    error: `crate::os::linux::raw::stat` is both a struct and a function
      --> library/std/src/os/linux/fs.rs:21:19
       |
    21 |     /// [`stat`]: crate::os::linux::raw::stat
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous link
       |
       = note: `-D broken-intra-doc-links` implied by `-D warnings`
    help: to link to the struct, prefix with the item type
       |
    21 |     /// [`stat`]: struct@crate::os::linux::raw::stat
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    help: to link to the function, add parentheses
       |
    21 |     /// [`stat`]: crate::os::linux::raw::stat()
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We want the `struct`, so it's now prefixed accordingly.

3 years agoRollup merge of #77766 - JohnTitor:fix-debug-config, r=jyn514
Yuki Okushi [Sat, 10 Oct 2020 18:19:16 +0000 (03:19 +0900)]
Rollup merge of #77766 - JohnTitor:fix-debug-config, r=jyn514

Clarify the debug-related values should take boolean

#76588 tweaked their placeholders but these values should take boolean and the current placeholders are confusing, at least for me.

3 years agoRollup merge of #77754 - bugadani:find_map_relevant_impl, r=matthewjasper
Yuki Okushi [Sat, 10 Oct 2020 18:19:14 +0000 (03:19 +0900)]
Rollup merge of #77754 - bugadani:find_map_relevant_impl, r=matthewjasper

Add TraitDef::find_map_relevant_impl

This PR adds a method to `TraitDef`. While `for_each_relevant_impl` covers the general use case, sometimes it's not necessary to scan through all the relevant implementations, so this PR introduces a new method, `find_map_relevant_impl`. I've also replaced the `for_each_relevant_impl` calls where possible.

I'm hoping for a tiny bit of efficiency gain here and there.

3 years agoRollup merge of #77748 - mati865:dead-code-cleanup, r=petrochenkov
Yuki Okushi [Sat, 10 Oct 2020 18:19:12 +0000 (03:19 +0900)]
Rollup merge of #77748 - mati865:dead-code-cleanup, r=petrochenkov

Dead code cleanup in windows-gnu std

Closes https://github.com/rust-lang/rust/issues/77622

This is the only leftover I could find.

3 years agoRollup merge of #77738 - RalfJung:alloc-error-handler-comment, r=Amanieu
Yuki Okushi [Sat, 10 Oct 2020 18:19:10 +0000 (03:19 +0900)]
Rollup merge of #77738 - RalfJung:alloc-error-handler-comment, r=Amanieu

fix __rust_alloc_error_handler comment

`__rust_alloc_error_handler` was added in the same `extern` block as the allocator functions, but the comment there was not actually correct for `__rust_alloc_error_handler`. So move it down to the rest of the default allocator handling with a fixed comment. At least the comment reflects my understanding of what happens, please check carefully. :)

r? @Amanieu Cc @haraldh

3 years agoRollup merge of #77709 - pickfire:patch-1, r=jyn514
Yuki Okushi [Sat, 10 Oct 2020 18:19:09 +0000 (03:19 +0900)]
Rollup merge of #77709 - pickfire:patch-1, r=jyn514

Link Vec leak doc to Box

3 years agoRollup merge of #77629 - Julian-Wollersberger:recomputeRawStrError, r=varkor
Yuki Okushi [Sat, 10 Oct 2020 18:19:07 +0000 (03:19 +0900)]
Rollup merge of #77629 - Julian-Wollersberger:recomputeRawStrError, r=varkor

Cleanup of `eat_while()` in lexer

The size of a lexer Token was inflated by the largest `TokenKind` variants `LiteralKind::RawStr` and `RawByteStr`, because
* it used `usize` although `u32` is sufficient in rustc, since crates must be smaller than 4GB,
* and it stored the 20 bytes big `RawStrError` enum for error reporting.

If a raw string is invalid, it now needs to be reparsed to get the `RawStrError` data, but that is a very cold code path.

Technically this breaks other tools that depend on rustc_lexer because they are now also restricted to a max file size of 4GB. But this shouldn't matter in practice, and rustc_lexer isn't stable anyway.

Can I also get a perf run?

Edit: This makes no difference in performance. The PR now only contains a small cleanup.

3 years agoRollup merge of #77195 - follower:patch-2, r=jyn514
Yuki Okushi [Sat, 10 Oct 2020 18:19:05 +0000 (03:19 +0900)]
Rollup merge of #77195 - follower:patch-2, r=jyn514

Link to documentation-specific guidelines.

Changed contribution information URL because it's not obvious how to get from the current URL to the documentation-specific content.

The current URL points to this "Getting Started" page, which contains nothing specific about documentation[*] and instead launches into how to *build* `rustc` which is not a strict prerequisite for contributing documentation fixes:

 * https://rustc-dev-guide.rust-lang.org/getting-started.html

[*] The most specific content is a "Writing documentation" bullet point which is not itself a link to anything (I guess a patch for that might be helpful too).

### Why?

Making this change will make it easier for people who wish to make small "drive by" documentation fixes (and read contribution guidelines ;) ) which I find are often how I start contributing to a project. (Exhibit A: https://github.com/rust-lang/rust/pull/77050 :) )

### Background

My impression is the change of content linked is an unintentional change due to a couple of other changes:

 * Originally, the link pointed to  `contributing.md` which started with a "table of contents" linking to each section. But the content in `contributing.md` was removed and replaced with a link to the "Getting Started" section here:

    * https://github.com/rust-lang/rust/commit/3f6928f1f6eff367e6ddbfb63ebc5e568ffe0eb1#diff-6a3371457528722a734f3c51d9238c13L1

   But the changed link doesn't actually point to the equivalent content, which is now located here:

    * https://rustc-dev-guide.rust-lang.org/contributing.html

   (If the "Guide to Rustc Development" is now considered the canonical location of "How to Contribute" content it might be a good idea to merge some of the "Contributing" Introduction section into the "Getting Started" section.)

 * This was then compounded by changing the link from `contributing.md` to  `contributing.html` here:

     * https://github.com/rust-lang/rust/pull/74037/files#diff-242481015141f373dcb178e93cffa850L88

    In order to even find the new location of the previous `contributing.md` content I ended up needing to do a GitHub search of the `rust-lang` org for the phrase "Documentation improvements are very welcome". :D

3 years agoAuto merge of #77337 - lzutao:asm-mips64, r=Amanieu
bors [Sat, 10 Oct 2020 17:32:28 +0000 (17:32 +0000)]
Auto merge of #77337 - lzutao:asm-mips64, r=Amanieu

Add asm! support for mips64

- [x] Updated `src/doc/unstable-book/src/library-features/asm.md`.
- [ ] No vector type support. I don't know much about those types.

cc #76839

3 years agoRefactor how SwitchInt stores jump targets
Jonas Schievink [Sat, 10 Oct 2020 15:36:04 +0000 (17:36 +0200)]
Refactor how SwitchInt stores jump targets

3 years agoAuto merge of #77771 - nagisa:revert-77023, r=Mark-Simulacrum
bors [Sat, 10 Oct 2020 15:17:01 +0000 (15:17 +0000)]
Auto merge of #77771 - nagisa:revert-77023, r=Mark-Simulacrum

Revert "Assume slice len is bounded by allocation size"

https://github.com/rust-lang/rust/pull/77023#issuecomment-703987379
suggests that the original PR introduced a significant perf regression.

This reverts commit e44784b8750016a695361c990024750e037d8f9f / #77023.

cc `@HeroicKatora`

3 years agoClarify the debug-related values should take boolean
Yuki Okushi [Fri, 9 Oct 2020 20:36:33 +0000 (05:36 +0900)]
Clarify the debug-related values should take boolean

They should take boolean values and the current placeholders are confusing, at least for me.

3 years agoTake functions by value
Dániel Buga [Fri, 9 Oct 2020 15:22:25 +0000 (17:22 +0200)]
Take functions by value

3 years agoImprove vec leak wording
Ivan Tham [Sat, 10 Oct 2020 14:17:48 +0000 (22:17 +0800)]
Improve vec leak wording

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoAlloc vec doc mention cannot undo leak
Ivan Tham [Sat, 10 Oct 2020 14:12:28 +0000 (22:12 +0800)]
Alloc vec doc mention cannot undo leak

3 years agoUpdate `changelog-seen` in config.toml.example
Joshua Nelson [Sat, 10 Oct 2020 14:08:36 +0000 (10:08 -0400)]
Update `changelog-seen` in config.toml.example

This got out of sync when the version was bumped last time.

Long-term we may want to find an easier way to maintain this that
doesn't require bumping the version in three different places. Off the
top of my head I can't think of anything, though.