]> git.lizzy.rs Git - rust.git/log
rust.git
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 agoBless expected errors
Ethan Brierley [Mon, 12 Oct 2020 21:27:59 +0000 (22:27 +0100)]
Bless expected errors

3 years agoInclude `llvm-dis`, `llc` and `opt` in `llvm-tools-preview` component
Aaron Hill [Mon, 12 Oct 2020 20:02:48 +0000 (16:02 -0400)]
Include `llvm-dis`, `llc` and `opt` in `llvm-tools-preview` component

Fixes #55890

It's useful to have `llc` and `opt` available when debugging an LLVM
miscompilation,.

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 agoA little rewording
Ethan Brierley [Mon, 12 Oct 2020 20:58:06 +0000 (15:58 -0500)]
A little rewording

Co-authored-by: varkor <github@varkor.com>
3 years agoRemove a little jargon from error
Ethan Brierley [Mon, 12 Oct 2020 20:57:04 +0000 (15:57 -0500)]
Remove a little jargon from error

Co-authored-by: varkor <github@varkor.com>
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 agoClean up rustdoc HTML tags check pass
Guillaume Gomez [Fri, 9 Oct 2020 12:48:45 +0000 (14:48 +0200)]
Clean up rustdoc HTML tags check pass

3 years agoMade a submodule for fn_ctxt
Nicholas-Baron [Mon, 12 Oct 2020 18:57:29 +0000 (11:57 -0700)]
Made a submodule for fn_ctxt

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 agoMake error help clearer
Ethan Brierley [Mon, 12 Oct 2020 12:18:29 +0000 (07:18 -0500)]
Make error help clearer

Co-authored-by: varkor <github@varkor.com>
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 agoRemove dump_incremental_data
bjorn3 [Mon, 12 Oct 2020 08:34:30 +0000 (10:34 +0200)]
Remove dump_incremental_data

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 agoMoved the functions starting with check to a separate file
Nicholas-Baron [Mon, 12 Oct 2020 00:27:29 +0000 (17:27 -0700)]
Moved the functions starting with check to a separate file

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 agoMoved the functions starting with suggest to a separate file
Nicholas-Baron [Sun, 11 Oct 2020 23:28:06 +0000 (16:28 -0700)]
Moved the functions starting with suggest to a separate file

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 agoMoved some short functions back into fn_ctxt.rs
Nicholas-Baron [Sun, 11 Oct 2020 22:59:41 +0000 (15:59 -0700)]
Moved some short functions back into fn_ctxt.rs

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 agobootstrap: only use compiler-builtins-c if they exist
George Burgess IV [Sun, 11 Oct 2020 19:05:31 +0000 (12:05 -0700)]
bootstrap: only use compiler-builtins-c if they exist

The assignment of `features` above was added in rust-lang#60981, but
never used. Presumably the intent was to replace the string literal here
with it.

While I'm in the area, `compiler_builtins_c_feature` doesn't need to be
a `String`.

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 ago`min_const_generics` diagnostics improvements
Ethan Brierley [Sun, 11 Oct 2020 15:47:45 +0000 (16:47 +0100)]
`min_const_generics` diagnostics improvements

2

3

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 agoAdd hack to keep `actix-web` and `actori-web` compiling
Aaron Hill [Sun, 11 Oct 2020 17:07:45 +0000 (13:07 -0400)]
Add hack to keep `actix-web` and `actori-web` compiling

This extends the existing `ident_name_compatibility_hack` to handle the
`tuple_from_req` macro defined in `actix-web` (and its fork
`actori-web`).

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 agoRemove unused import
Aaron Hill [Tue, 29 Sep 2020 04:31:13 +0000 (00:31 -0400)]
Remove unused import

3 years agoAdd `relaxed_delim_match` parameter
Aaron Hill [Sat, 26 Sep 2020 17:12:49 +0000 (13:12 -0400)]
Add `relaxed_delim_match` parameter

3 years agoAllow skipping extra paren insertion during AST pretty-printing
Aaron Hill [Sat, 26 Sep 2020 16:51:00 +0000 (12:51 -0400)]
Allow skipping extra paren insertion during AST pretty-printing

Fixes #74616
Makes progress towards #43081
Unblocks PR #76130

When pretty-printing an AST node, we may insert additional parenthesis
to ensure that precedence is properly preserved in code we output.
However, the proc macro implementation relies on comparing a
pretty-printed AST node to the captured `TokenStream`. Inserting extra
parenthesis changes the structure of the reparsed `TokenStream`, making
the comparison fail.

This PR refactors the AST pretty-printing code to allow skipping the
insertion of additional parenthesis. Several freestanding methods are
moved to trait methods on `PrintState`, which keep track of an internal
`insert_extra_parens` flag. This flag is normally `true`, but we expose
a public method which allows pretty-printing a nonterminal with
`insert_extra_parens = false`.

To avoid changing the public interface of `rustc_ast_pretty`, the
freestanding `_to_string` methods are changed to delegate to a
newly-crated `State`. The main pretty-printing code is moved to a new
`state` module to ensure that it does not accidentally call any of these
public helper functions (instead, the internal functions with the same
name should be used).

3 years agoMove pprust code to a 'state' submodule
Aaron Hill [Sat, 26 Sep 2020 16:41:53 +0000 (12:41 -0400)]
Move pprust code to a 'state' submodule

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 agoMove `PartialOrd` impl out of rustc
Joshua Nelson [Sun, 11 Oct 2020 15:11:33 +0000 (11:11 -0400)]
Move `PartialOrd` impl out of rustc

Rustdoc's ordering requirements are probably not relevant to the rest of
the compiler.

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 agoRemove unnecessary Clean impl
Joshua Nelson [Sun, 11 Oct 2020 14:01:27 +0000 (10:01 -0400)]
Remove unnecessary Clean impl

3 years agoSwitch rustdoc from `clean::Stability` to `rustc_attr::Stability`
Joshua Nelson [Sun, 11 Oct 2020 13:55:17 +0000 (09:55 -0400)]
Switch rustdoc from `clean::Stability` to `rustc_attr::Stability`

This gives greater type safety and is less work to maintain on the
rustdoc end.

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 agotraits diagnostics: Don't print closure/generator upvar_tys tuple
Aman Arora [Thu, 8 Oct 2020 04:28:53 +0000 (00:28 -0400)]
traits diagnostics: Don't print closure/generator upvar_tys tuple

Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
3 years agoAlways return tupled_upvar_tys for Closure/Generator consituent tys
Aman Arora [Fri, 2 Oct 2020 01:06:16 +0000 (21:06 -0400)]
Always return tupled_upvar_tys for Closure/Generator consituent tys

Depending on if upvar_tys inferred or not, we were returning either an
inference variable which later resolves to a tuple or else the upvar tys
themselves

Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
3 years agoReplace tuple of infer vars for upvar_tys with single infer var
Roxane [Sun, 19 Jul 2020 21:26:51 +0000 (17:26 -0400)]
Replace tuple of infer vars for upvar_tys with single infer var

This commit allows us to decide the number of captures required after
completing capture ananysis, which is required as part of implementing
RFC-2229.

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com>
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 agoMoved the main `impl` for FnCtxt to its own file.
Nicholas-Baron [Sun, 11 Oct 2020 00:43:32 +0000 (17:43 -0700)]
Moved the main `impl` for FnCtxt to its own file.

This is a solution to the file length being over 3000, something Clippy has a problem with.

The other solution to the file length is
1. to change the API of this struct by
2. encapulating certain fields of the struct into other structs.

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.