Commit graph

156335 commits

Author SHA1 Message Date
Laurențiu Nicola
72ca6cd990 ⬆️ rust-analyzer 2021-10-18 10:23:58 +03:00
bors
5e02151318 Auto merge of #89499 - Mark-Simulacrum:with-llvm-13, r=nikic
Split out LLVM PGO step and use clang 13 to compile LLVM

We're seeing a PGO version mismatch error in CI logs:

    LLVM Profile Error: Runtime and instrumentation version mismatch : expected 5, but get 7

which is likely due to the version bumped here differing from that used by
rustc.

This PR fixes this by splitting out the PGO step for LLVM into a separate phase of the pgo.sh script, which nets no change to performance (see [these results](https://perf.rust-lang.org/compare.html?start=c34ac8747ca96d09cb08b8f5adddead826e77c06&end=e272c2af45f40c74dab83948235903ffbe3ad57f)). Then, it follows that up with an upgrade to LLVM/clang version 13 as our bootstrap compiler, which yields the performance improvements for this PR -- around 5%. This depends on the first step here, because otherwise we end up somehow clobbering or otherwise hurting our ability to effectively collect performance data, yielding reductions in performance for a subset of benchmarks -- it is not clear what the cause here was precisely, but the split only costs ~10 minutes and seems worthwhile.
2021-10-17 22:29:31 +00:00
bors
1f12ac8729 Auto merge of #89984 - matthiaskrgr:rollup-ikmyhmx, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #89738 (ty::pretty: prevent infinite recursion for `extern crate` paths.)
 - #89888 (Make `llvm.download-ci-llvm="if-available"` work for tier 2 targets with host tools)
 - #89945 (Remove a mention to `copy_from_slice` from `clone_from_slice` doc)
 - #89946 (Fix an ICE with TAITs and Future)
 - #89963 (Some "parenthesis" and "parentheses" fixes)
 - #89975 (Add a regression test for #85921)
 - #89977 (Make Result::as_mut const)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-17 19:18:18 +00:00
Matthias Krüger
f044a84f5d
Rollup merge of #89977 - woppopo:result_const_as_mut, r=oli-obk
Make Result::as_mut const

Adding `const` for `Result::as_mut`.

Tracking issue: #82814
2021-10-17 18:19:00 +02:00
Matthias Krüger
1ee7c2940e
Rollup merge of #89975 - JohnTitor:gats-tests-85921, r=jackh726
Add a regression test for #85921

Closes #85921
r? `@jackh726`
2021-10-17 18:18:59 +02:00
Matthias Krüger
e0e2b3cc43
Rollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisa
Some "parenthesis" and "parentheses" fixes

"Parenthesis" is the singular (e.g. one `(` or one `)`) and "parentheses" is the plural (multiple `(` or `)`s) and this is not hard to mix up so here are some fixes for that.

Inspired by #89958
2021-10-17 18:18:59 +02:00
Matthias Krüger
0f1ba8d8c7
Rollup merge of #89946 - JohnTitor:fix-89686, r=petrochenkov
Fix an ICE with TAITs and Future

Fixes #89686
2021-10-17 18:18:58 +02:00
Matthias Krüger
1520fffecc
Rollup merge of #89945 - JohnTitor:we-now-specialize-clone-from-slice, r=the8472
Remove a mention to `copy_from_slice` from `clone_from_slice` doc

Fixes #84736
I think removing it would be the best but I'm happy to clarify it instead if someone would like.
2021-10-17 18:18:57 +02:00
Matthias Krüger
eb69090e7b
Rollup merge of #89888 - rusticstuff:download-ci-llvm-apple-arm64, r=Mark-Simulacrum
Make `llvm.download-ci-llvm="if-available"` work for tier 2 targets with host tools

`llvm.download-ci-llvm="if-available"` is used for most profiles configured via `x.py setup`. It allows downloading prebuilt LLVM tarballs from the CI artifacts for a configured list of platforms. Currently this list is restricted to tier 1 targets but it makes sense for all tier 2 targets with host tools.
2021-10-17 18:18:56 +02:00
Matthias Krüger
59dc2187ad
Rollup merge of #89738 - eddyb:extern-crate-recursion, r=nagisa
ty::pretty: prevent infinite recursion for `extern crate` paths.

Fixes #55779, fixes #87932.

This fix is based on `@estebank's` idea in https://github.com/rust-lang/rust/issues/55779#issuecomment-614758510 - but instead of trying to get `try_print_visible_def_path_recur`'s cycle detection to work in this case, this PR "just" disables the "visible path" feature when printing the path to an `extern crate`, so that the old recursion chain of `try_print_visible_def_path -> print_def_path -> try_print_visible_def_path`, is now impossible.

Both tests have been confirmed to crash `rustc` because of a stack overflow, without the fix.
2021-10-17 18:18:55 +02:00
bors
8db8f48ea8 Auto merge of #89981 - pietroalbini:1.56-version-bump, r=pietroalbini
Bump version to Rust 1.58.0

cc `@Mark-Simulacrum`
r? `@ghost`
2021-10-17 15:35:28 +00:00
Pietro Albini
52f52c4fa1
bump version to rust 1.58.0 2021-10-17 16:04:44 +02:00
bors
6f53ddfa74 Auto merge of #89514 - davidtwco:polymorphize-shims-and-predicates, r=lcnr
polymorphization: shims and predicates

Supersedes #75737 and #75414. This pull request includes up some changes to polymorphization which hadn't landed previously and gets stage2 bootstrapping and the test suite passing when polymorphization is enabled. There are still issues with `type_id` and polymorphization to investigate but this should get polymorphization in a reasonable state to work on.

- #75737 and #75414 both worked but were blocked on having the rest of the test suite pass (with polymorphization enabled) with and without the PRs. It makes more sense to just land these so that the changes are in.
- #75737's changes remove the restriction of `InstanceDef::Item` on polymorphization, so that shims can now be polymorphized. This won't have much of an effect until polymorphization's analysis is more advanced, but it doesn't hurt.
- #75414's changes remove all logic which marks parameters as used based on their presence in predicates - given #75675, this will enable more polymorphization and avoid the symbol clashes that predicate logic previously sidestepped.
- Polymorphization now explicitly checks (and skips) foreign items, this is necessary for stage2 bootstrapping to work when polymorphization is enabled.
- The conditional determining the emission of a note adding context to a post-monomorphization error has been modified. Polymorphization results in `optimized_mir` running for shims during collection where that wouldn't happen previously, some errors are emitted during `optimized_mir` and these were considered post-monomorphization errors with the existing logic (more errors and shims have a `DefId` coming from the std crate, not the local crate), adding a note that resulted in tests failing. It isn't particularly feasible to change where polymorphization runs or prevent it from using `optimized_mir`, so it seemed more reasonable to not change the conditional.
- `characteristic_def_id_of_type` was being invoked during partitioning for self types of impl blocks which had projections that depended on the value of unused generic parameters of a function - this caused a ICE in a debuginfo test. If partitioning is enabled and the instance needs substitution then this is skipped. That test still fails for me locally, but not with an ICE, but it fails in a fresh checkout too, so 🤷‍♂️.

r? `@lcnr`
2021-10-17 12:33:12 +00:00
r00ster91
3c1d55422a Some "parenthesis" and "parentheses" fixes 2021-10-17 12:04:01 +02:00
woppopo
ea28abee28 Make Result::as_mut const 2021-10-17 18:39:54 +09:00
bors
1d6f24210c Auto merge of #88652 - AGSaidi:linux-aarch64-should-be-actually-monotonic, r=yaahc
linux/aarch64 Now() should be actually_monotonic()

While issues have been seen on arm64 platforms the Arm architecture requires
that the counter monotonically increases and that it must provide a uniform
view of system time (e.g. it must not be possible for a core to receive a
message from another core with a time stamp and observe time going backwards
(ARM DDI 0487G.b D11.1.2). While there have been a few 64bit SoCs that have
bugs (#49281, #56940) which cause time to not monotonically increase, these have
been fixed in the Linux kernel and we shouldn't penalize all Arm SoCs for those
who refuse to update their kernels:
SUN50I_ERRATUM_UNKNOWN1 - Allwinner A64 / Pine A64 - fixed in 5.1
FSL_ERRATUM_A008585 - Freescale LS2080A/LS1043A - fixed in 4.10
HISILICON_ERRATUM_161010101 - Hisilicon 1610 - fixed in 4.11
ARM64_ERRATUM_858921 - Cortex A73 - fixed in 4.12

255a3f3e18 std: Force `Instant::now()` to be monotonic added a Mutex to work around
this problem and a small test program using glommio shows the majority of time spent
acquiring and releasing this Mutex. 3914a7b0da tries to improve this, but actually
makes it worse on big systems as for 128b atomics a ldxp/stxp pair (and successful loop)
for v8.4 systems that don't support FEAT_LSE2 is required which is expensive as a lock
and because of how the load/store-exclusives scale on large Arm systems is both unfair
to threads and tends to go backwards in performance.

A small sample program using glommio improves by 70x on a 32 core Graviton2
system with this change.
2021-10-17 09:30:30 +00:00
Yuki Okushi
6bcf0e471b
Add a regression test for #85921 2021-10-17 16:09:49 +09:00
bors
12b5bce0d7 Auto merge of #89968 - JohnTitor:rollup-z51n967, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #89507 (Add `#[repr(i8)]` to `Ordering`)
 - #89849 (CI: Selecting the Xcode version no longer needed with the macos-11 runners.)
 - #89886 (Update the wasi-libc built with the wasm32-wasi target)
 - #89907 (Remove FIXME since there is nothing to be fixed)
 - #89943 (clippy::complexity fixes)
 - #89953 (Make Option::as_mut const)
 - #89958 (Correct small typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-17 06:27:08 +00:00
Yuki Okushi
dc2e301eb9
Rollup merge of #89958 - nhamovitz:patch-1, r=nagisa
Correct small typo
2021-10-17 07:52:22 +09:00
Yuki Okushi
0029af7930
Rollup merge of #89953 - woppopo:option_const_as_mut, r=oli-obk
Make Option::as_mut const

Adding `const` for `Option::as_mut`.

Tracking issue: #67441
2021-10-17 07:52:21 +09:00
Yuki Okushi
b8173c59c6
Rollup merge of #89943 - matthiaskrgr:clpcompl, r=oli-obk
clippy::complexity fixes
2021-10-17 07:52:20 +09:00
Yuki Okushi
c393f33d35
Rollup merge of #89907 - GuillaumeGomez:correctly-emit-errors, r=camelid
Remove FIXME since there is nothing to be fixed

Resolves #88593.

The errors are deduplicated when displayed to users. They only appear
multiple times in UI tests.

cc ``@jyn514``
r? ``@camelid``
2021-10-17 07:52:19 +09:00
Yuki Okushi
607cfe7a01
Rollup merge of #89886 - alexcrichton:update-wasi-libc, r=kennytm
Update the wasi-libc built with the wasm32-wasi target

This commit updates the wasi-libc that we include with the wasm32-wasi
target, which brings in various misc fixes such as musl updates and some
math tweaks.
2021-10-17 07:52:18 +09:00
Yuki Okushi
e92f25265a
Rollup merge of #89849 - rusticstuff:remove-xcode-select, r=Mark-Simulacrum
CI: Selecting the Xcode version no longer needed with the macos-11 runners.

It does nothing nowadays since `/Applications/Xcode_12.2.app` does not exist in the GH runner environment and
automatically using the latest version selected by the GH environment is better anyway.
2021-10-17 07:52:18 +09:00
Yuki Okushi
9614da27cd
Rollup merge of #89507 - lopopolo:lopopolo/ordering-repr-i8, r=joshtriplett
Add `#[repr(i8)]` to `Ordering`

Followup to #89491 to allow `Ordering` to auto-derive `AsRepr` once the proposal to add `AsRepr` (#81642) lands.

cc ``@joshtriplett``
2021-10-17 07:52:17 +09:00
nhamovitz
2b3685a6cb
Correct typo 2021-10-16 13:36:05 -07:00
Guillaume Gomez
7bad85e815 Remove FIXME since there is nothing to be fixed.
The errors are deduplicated when displayed to users. They only appear
multiple times in UI tests.
2021-10-16 22:15:06 +02:00
bors
4e89811b46 Auto merge of #89860 - camsteffen:macro-semi, r=petrochenkov
Remove trailing semicolon from macro call span

Macro call site spans are now less surprising/more consistent since they no longer contain a semicolon after the macro call.

The downside is that we need to do a little guesswork to get the semicolon in diagnostics. But this should not be noticeable since it is rare for the semicolon to not immediately follow the macro call.
2021-10-16 18:20:20 +00:00
Matthias Krüger
c645d3f3b9 clippy::complexity changes 2021-10-16 18:11:16 +02:00
woppopo
d1f7608699 Add #![cfg_attr(bootstrap, feature(const_panic))] to library/core/tests/lib.rs 2021-10-17 00:32:01 +09:00
woppopo
00dba3a693 Make Option::as_mut const 2021-10-17 00:02:42 +09:00
Yuki Okushi
f001e8c519
Fix an ICE with TAITs and Future 2021-10-16 18:30:37 +09:00
Yuki Okushi
1df185ac02
Remove a mention to copy_from_slice from clone_from_slice doc 2021-10-16 17:30:34 +09:00
bors
7fbd4ce276 Auto merge of #89939 - matthiaskrgr:rollup-q3lrdck, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #89509 (Stabilize `unreachable_unchecked` as `const fn`)
 - #89898 (Remove alloc::prelude)
 - #89902 (Restrict the aarch64 outline atomics test to Linux)
 - #89906 (Moved format-version constant to rustdoc-json-types)
 - #89912 (emitter: current substitution can be multi-line)
 - #89914 (Emit impl difference error for GenericBoundFailure too)
 - #89915 (Some outlives cleanup)
 - #89918 (Add some GATs related regression tests)
 - #89921 ([fuchsia] Update process info struct)
 - #89925 (updating docs to mention usage of AtomicBool)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-16 06:31:40 +00:00
Matthias Krüger
8e20470425
Rollup merge of #89925 - gilescope:update-docs-atomic-usage, r=m-ou-se
updating docs to mention usage of AtomicBool

Mouse mentioned we should point out that atomic bool is used by the std lib these days. ( https://github.com/m-ou-se/getrandom/pull/1 )
2021-10-16 08:02:28 +02:00
Matthias Krüger
29f05c6220
Rollup merge of #89921 - joshuaseaton:zircon-process, r=tmandry
[fuchsia] Update process info struct

The fuchsia platform is in the process of softly transitioning over to
using a new value for ZX_INFO_PROCESS with a new corresponding struct.
This change migrates libstd.

See [fxrev.dev/510478](https://fxrev.dev/510478) and [fxbug.dev/30751](https://fxbug.dev/30751) for more detail.
2021-10-16 08:02:27 +02:00
Matthias Krüger
4fa5d6e5f8
Rollup merge of #89918 - JohnTitor:gats-tests, r=jackh726
Add some GATs related regression tests

Closes #88287, closes #88405
2021-10-16 08:02:26 +02:00
Matthias Krüger
502d57b32d
Rollup merge of #89915 - jackh726:outlives_cleanup, r=nikomatsakis
Some outlives cleanup

No semantic changes here, only moving code around + using `LocalDefId` instead of `HirId`

r? ````@nikomatsakis````
2021-10-16 08:02:25 +02:00
Matthias Krüger
e8efe0931a
Rollup merge of #89914 - jackh726:gat_genericboundfailure, r=estebank
Emit impl difference error for GenericBoundFailure too

Fixes #86787

r? ````@estebank````
2021-10-16 08:02:24 +02:00
Matthias Krüger
27a7ced29f
Rollup merge of #89912 - davidtwco:issue-89280-split-lines-multiple-lines, r=oli-obk
emitter: current substitution can be multi-line

Fixes #89280.

In `splice_lines`, there is some arithmetic to compute the required alignment such that future substitutions in a suggestion are aligned correctly. However, this assumed that the current substitution's span was only on a single line. In circumstances where this was not true, it could result in a arithmetic overflow when the substitution's end column was less than the substitution's start column.

r? ````@oli-obk````
2021-10-16 08:02:24 +02:00
Matthias Krüger
e98669a51a
Rollup merge of #89906 - yuvaldolev:move-format-version-to-rustdoc-json-types, r=CraftSpider
Moved format-version constant to rustdoc-json-types

Addresses #88620

Moved format-version constant from rustdoc to rustdoc-json-types.
2021-10-16 08:02:23 +02:00
Matthias Krüger
e56b5ee716
Rollup merge of #89902 - rusticstuff:outline-atomics-linux-only, r=workingjubilee
Restrict the aarch64 outline atomics test to Linux

The test was introduced in #83655, which enables the `outline-atomics` feature for aarch64-unknown-linux-* but not for any other aarch64 targets. The test did not check for Linux causing test failures on aarch64-apple-darwin.

r? `@workingjubilee`
2021-10-16 08:02:22 +02:00
Matthias Krüger
dfed1a6c07
Rollup merge of #89898 - Amanieu:remove_alloc_prelude, r=joshtriplett
Remove alloc::prelude

As per the libs team decision in #58935.

Closes #58935
2021-10-16 08:02:21 +02:00
Matthias Krüger
9ae0804859
Rollup merge of #89509 - jhpratt:stabilize-const_unreachable_unchecked, r=oli-obk
Stabilize `unreachable_unchecked` as `const fn`

Closes #53188

This PR stabilizes `core::hint::unreachable_unchecked` as `const fn`. MIRI is able to detect when this method is called. Stabilization was delayed until `const_panic` was stabilized so as to avoid users calling this method in its place (thus resulting in runtime UB). With #89508, that is no longer an issue.

````@rustbot```` label +A-const-eval +A-const-fn +T-lang +S-blocked

(not sure why it's T-lang, but that's what the tracking issue is)
2021-10-16 08:02:20 +02:00
bors
6cc0a764e0 Auto merge of #85379 - mdaverde:uds-abstract, r=joshtriplett
Add abstract namespace support for Unix domain sockets

Hello! The other day I wanted to mess around with UDS in Rust and found that abstract namespaces ([unix(7)](https://man7.org/linux/man-pages/man7/unix.7.html)) on Linux still needed development. I took the approach of adding `_addr` specific public functions to reduce conflicts.

Feature name: `unix_socket_abstract`
Tracking issue: #85410
Further context: #42048

## Non-platform specific additions

`UnixListener::bind_addr(&SocketAddr) -> Result<UnixListener>`

`UnixStream::connect_addr(&SocketAddr) -> Result<()>`

`UnixDatagram::bind_addr(&SocketAddr) -> Result<UnixDatagram>`

`UnixDatagram::connect_addr(&SocketAddr) -> Result<()>`

`UnixDatagram::send_to_addr(&self, &[u8], &SocketAddr) -> Result<usize>`

## Platform-specific (Linux) additions

`SocketAddr::from_abstract_namespace(&[u8]) -> SocketAddr`

`SockerAddr::as_abstract_namespace() -> Option<&[u8]>`

## Example

```rust
#![feature(unix_socket_abstract)]
use std::os::unix::net::{UnixListener, SocketAddr};

fn main() -> std::io::Result<()> {
    let addr = SocketAddr::from_abstract_namespace(b"namespace")?; // Linux only
    let listener = match UnixListener::bind_addr(&addr) {
        Ok(sock) => sock,
        Err(err) => {
            println!("Couldn't bind: {:?}", err);
            return Err(err);
        }
    };
    Ok(())
}
```

## Further Details

The main inspiration for the implementation came from the [nix-rust](https://github.com/nix-rust/nix/blob/master/src/sys/socket/addr.rs#L558) crate but there are also other [historical](c4db0685b1) [attempts](https://github.com/tormol/uds/blob/master/src/addr.rs#L324) with similar approaches.

A comment I did have was with this change, we now allow a `SocketAddr` to be constructed explicitly rather than just used almost as a handle for the return of `peer_addr` and `local_addr`. We could consider adding other explicit constructors (e.g. `SocketAddr::from_pathname`, `SockerAddr::from_unnamed`).

Cheers!
2021-10-15 22:31:53 +00:00
Giles Cope
d3bddf3ea1
updating docs to reflect current situation 2021-10-15 20:43:52 +01:00
bors
c1026539bd Auto merge of #84096 - m-ou-se:windows-bcrypt-random, r=dtolnay
Use BCryptGenRandom instead of RtlGenRandom on Windows.

This removes usage of RtlGenRandom on Windows, in favour of BCryptGenRandom.

BCryptGenRandom isn't available on XP, but we dropped XP support a while ago.
2021-10-15 19:03:57 +00:00
Joshua Seaton
024baa9c32 [fuchsia] Update process info struct
The fuchsia platform is in the process of softly transitioning over to
using a new value for ZX_INFO_PROCESS with a new corresponding struct.
This change migrates libstd.

See fxrev.dev/510478 and fxbug.dev/30751 for more detail.
2021-10-15 10:40:39 -07:00
Yuki Okushi
a51798a27b
Add some GATs related regression tests 2021-10-16 01:38:49 +09:00
jackh726
2b5b456e23 Move some outlives bounds things from rustc_trait_selection to rustc_typeck 2021-10-15 12:14:19 -04:00