Commit Graph

129318 Commits

Author SHA1 Message Date
wcampbell 736c27ec0b Revert "[net] clippy: needless_update"
This reverts commit 058699d0a2.
2020-10-19 07:22:45 -04:00
wcampbell ce04836327
fmt
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2020-10-13 20:11:29 -04:00
wcampbell 7da0e58da4
use matches! in library/std/src/net/ip.rs
Apply suggestion from review

Co-authored-by: LingMan <LingMan@users.noreply.github.com>
2020-10-13 19:33:39 -04:00
wcampbell 7a75f44183
[net] clippy: identity_op
warning: the operation is ineffective. Consider reducing it to
`self.segments()[0]`
    --> library/std/src/net/ip.rs:1265:9
     |
1265 |         (self.segments()[0] & 0xffff) == 0xfe80
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `#[warn(clippy::identity_op)]` on by default
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: the operation is ineffective. Consider reducing it to
`self.segments()[1]`
    --> library/std/src/net/ip.rs:1266:16
     |
1266 |             && (self.segments()[1] & 0xffff) == 0
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: the operation is ineffective. Consider reducing it to
`self.segments()[2]`
    --> library/std/src/net/ip.rs:1267:16
     |
1267 |             && (self.segments()[2] & 0xffff) == 0
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

warning: the operation is ineffective. Consider reducing it to
`self.segments()[3]`
    --> library/std/src/net/ip.rs:1268:16
     |
1268 |             && (self.segments()[3] & 0xffff) == 0
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#identity_op

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2020-10-13 18:03:27 -04:00
wcampbell e6dc604e8b
[net] clippy: match_like_matches_macro
warning: match expression looks like `matches!` macro
   --> library/std/src/net/ip.rs:459:9
    |
459 | /         match self.octets() {
460 | |             [169, 254, ..] => true,
461 | |             _ => false,
462 | |         }
    | |_________^ help: try this: `matches!(self.octets(), [169, 254,
..])`
    |
    = note: `#[warn(clippy::match_like_matches_macro)]` on by default
    = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2020-10-13 18:00:59 -04:00
wcampbell 058699d0a2
[net] clippy: needless_update
warning: struct update has no effect, all the fields in the struct have
already been specified
   --> library/std/src/net/addr.rs:367:19
    |
367 |                 ..unsafe { mem::zeroed() }
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(clippy::needless_update)]` on by default
    = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#needless_update
2020-10-13 17:58:29 -04:00
bors abbdec3be6 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`
2020-10-12 23:04:55 +00:00
bors 8dae8cdcc8 Auto merge of #77847 - Xanewok:update-rls, r=Xanewok
Update RLS

cc #77819
Fixes #77810

r? `@ghost`
2020-10-12 21:03:35 +00:00
bors 16788545e7 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`
2020-10-12 19:09:08 +00:00
Yuki Okushi 984f78b7ed
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
2020-10-13 04:08:07 +09:00
Yuki Okushi 93ec29b0cb
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.
2020-10-13 04:08:05 +09:00
Yuki Okushi e40ae080ac
Rollup merge of #77831 - LingMan:use_std, r=jonas-schievink
Use std methods on char instead of open coding them
2020-10-13 04:08:03 +09:00
Yuki Okushi 233319fc65
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.
2020-10-13 04:08:02 +09:00
Yuki Okushi fe0d5b6828
Rollup merge of #77811 - jyn514:private, r=GuillaumeGomez
rustdoc: Make some functions private that don't need to be public

r? @GuillaumeGomez
2020-10-13 04:08:00 +09:00
Yuki Okushi 71d8c10886
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
2020-10-13 04:07:58 +09:00
Yuki Okushi dde997710a
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
2020-10-13 04:07:56 +09:00
Yuki Okushi ad6e179060
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
2020-10-13 04:07:54 +09:00
Yuki Okushi a6cc660774
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
2020-10-13 04:07:52 +09:00
Yuki Okushi 687d7646de
Rollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morse
add shims for WithOptConstParam query calls

r? @ecstatic-morse @eddyb
2020-10-13 04:07:50 +09:00
Yuki Okushi cabedfebcb Remove `mark-i-m` from rustc-dev-guide maintainers 2020-10-13 03:13:00 +09:00
bors f3ab6f0584 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`
2020-10-12 15:50:36 +00:00
Pietro Albini 5973fd42a2
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.
2020-10-12 17:39:13 +02:00
Guillaume Gomez 9f1048d723 Add word-wrap rule for short descriptions 2020-10-12 15:41:37 +02:00
12101111 5d44402345 update url in bootstrap README 2020-10-12 21:17:11 +08:00
bors d6b5ffb5b4 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.
2020-10-12 12:12:54 +00:00
Igor Matuszewski 1852392120 Update RLS 2020-10-12 13:10:43 +02:00
bors d9b931669b 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`
2020-10-12 10:17:48 +00:00
bors a8d6da3f57 Auto merge of #77837 - Aaron1011:bump-miri-backtrace, r=RalfJung
Bump miri

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

r? `@RalfJung`
2020-10-12 08:25:38 +00:00
bors 62cbe81b8a 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
2020-10-12 06:10:50 +00:00
bors 63962f0203 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
2020-10-12 04:18:56 +00:00
bors 1fe9b7f3fe 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`
2020-10-12 02:20:04 +00:00
Joshua Nelson 41878285e8 Remove unnecessary `RefCell` for doc_strings
This was there for `Divider` and is no longer necessary.
2020-10-11 20:31:00 -04:00
Joshua Nelson 1772f2d2dc 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`.
2020-10-11 20:27:17 -04:00
Jonas Schievink 32cf035046 Use no-prefer-dynamic 2020-10-12 01:51:40 +02:00
Aaron Hill 5e34bddc1b
Bump miri 2020-10-11 19:45:15 -04:00
Jonas Schievink 4f5394199b Fix -Clinker-plugin-lto with opt-levels s and z 2020-10-12 01:45:00 +02:00
bors 576e2277ac Auto merge of #75991 - shepmaster:silicon-ci, r=pietroalbini
Set up CI for aarch64-apple-darwin
2020-10-11 23:23:48 +00:00
Mateusz Mikuła 5aa661757a Update crossbeam-channel to avoid UB 2020-10-11 23:40:29 +02:00
bors c71248b708 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.
2020-10-11 20:50:02 +00:00
Winnie Xiao d7494af551 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
2020-10-11 22:32:06 +02:00
LingMan a56b0e96d0 Simplify using is_ascii_alphabetic and is_ascii_alphanumeric 2020-10-11 22:27:21 +02:00
LingMan e533bb73bc Don't duplicate char::is_ascii_digit 2020-10-11 22:27:20 +02:00
bors 06a079c43e Auto merge of #77824 - Aaron1011:bump-backtrace-miri, r=RalfJung
Bump backtrace-rs

Fixes #77791

r? `@RalfJung`

cc `@alexcrichton`
2020-10-11 18:24:40 +00:00
Aaron Hill 44fdfd66ab
Bump backtrace-rs
Fixes #77791
2020-10-11 13:52:20 -04:00
bors 8cc82ee340 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.
2020-10-11 16:33:47 +00:00
Joshua Nelson 83c790ffda Make some functions private that don't need to be public 2020-10-11 11:54:40 -04:00
Matthew Jasper b8d2560dca Use tracing spans in rustc_trait_selection 2020-10-11 16:08:23 +01:00
bors bc74dd711f 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>
2020-10-11 14:06:04 +00:00
bors c38f001db5 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`
2020-10-11 09:50:19 +00:00
bors c6bebc14a1 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`
2020-10-11 07:55:20 +00:00