]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #89956 - JohnTitor:suggest-case-insensitive-match-names, r=estebank
Matthias Krüger [Tue, 19 Oct 2021 03:40:53 +0000 (05:40 +0200)]
Rollup merge of #89956 - JohnTitor:suggest-case-insensitive-match-names, r=estebank

Suggest a case insensitive match name regardless of levenshtein distance

Fixes #86170

Currently, `find_best_match_for_name` only returns a case insensitive match name depending on a Levenshtein distance. It's a bit unfortunate that that hides some suggestions for typos like `Bar` -> `BAR`. That idea is from https://github.com/rust-lang/rust/pull/46347#discussion_r153701834, but I think it still makes some sense to show a candidate when we find a case insensitive match name as it's more like a typo.
Skipped the `candidate != lookup` check because the current (i.e, `levenshtein_match`) returns the exact same `Symbol` anyway but it doesn't seem to confuse anything on UI tests.

r? ``@estebank``

2 years agoRollup merge of #89941 - hermitcore:kernel, r=joshtriplett
Matthias Krüger [Tue, 19 Oct 2021 03:40:52 +0000 (05:40 +0200)]
Rollup merge of #89941 - hermitcore:kernel, r=joshtriplett

removing TLS support in x86_64-unknown-none-hermitkernel

HermitCore's kernel itself doesn't support TLS. Consequently, the entries in x86_64-unknown-none-hermitkernel should be removed. This commit should help to finalize #89062.

2 years agoRollup merge of #89867 - Urgau:fix-double-definition, r=GuillaumeGomez
Matthias Krüger [Tue, 19 Oct 2021 03:40:51 +0000 (05:40 +0200)]
Rollup merge of #89867 - Urgau:fix-double-definition, r=GuillaumeGomez

Fix macro_rules! duplication when reexported in the same module

This can append if within the same module a `#[macro_export] macro_rules!`
is declared but also a reexport of itself producing two export of the same
macro in the same module. In that case we only want to document it once.

Before:
```
Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
        Id("0:3"),   // duplicate, same as above
    ],
}
```

After:
```
Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
    ],
}
```

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

2 years agoRollup merge of #89766 - krasimirgg:llvm-14-targetregistrty, r=nagisa
Matthias Krüger [Tue, 19 Oct 2021 03:40:50 +0000 (05:40 +0200)]
Rollup merge of #89766 - krasimirgg:llvm-14-targetregistrty, r=nagisa

RustWrapper: adapt for an LLVM API change

No functional changes intended.

The LLVM commit
https://github.com/llvm/llvm-project/commit/89b57061f7b769e9ea9bf6ed686e284f3e55affe
moved TargetRegistry.(h|cpp) from Support to MC.
This adapts RustWrapper accordingly.

2 years agoAuto merge of #89229 - oli-obk:i_love_inferctxt, r=jackh726
bors [Mon, 18 Oct 2021 23:02:53 +0000 (23:02 +0000)]
Auto merge of #89229 - oli-obk:i_love_inferctxt, r=jackh726

Remove redundant member-constraint check

impl trait will, for each lifetime in the hidden type, register a "member constraint" that says the lifetime must be equal or outlive one of the lifetimes of the impl trait. These member constraints will be solved by borrowck

But, as you can see in the big red block of removed code, there was an ad-hoc check for member constraints happening at the site where they get registered. This check had some minor effects on diagnostics, but will fall down on its feet with my big type alias impl trait refactor. So we removed it and I pulled the removal out into a (hopefully) reviewable PR that works on master directly.

2 years agoAuto merge of #89124 - cjgillot:owner-info, r=michaelwoerister
bors [Mon, 18 Oct 2021 19:53:05 +0000 (19:53 +0000)]
Auto merge of #89124 - cjgillot:owner-info, r=michaelwoerister

Index and hash HIR as part of lowering

Part of https://github.com/rust-lang/rust/pull/88186
~Based on https://github.com/rust-lang/rust/pull/88880 (see merge commit).~

Once HIR is lowered, it is later indexed by the `index_hir` query and hashed for `crate_hash`. This PR moves those post-processing steps to lowering itself. As a side objective, the HIR crate data structure is refactored as an `IndexVec<LocalDefId, Option<OwnerInfo<'hir>>>` where `OwnerInfo` stores all the relevant information for an HIR owner.

r? `@michaelwoerister`
cc `@petrochenkov`

2 years agoMember constraints already covered all of E0482 already, so that error never occurred...
Oli Scherer [Sat, 16 Oct 2021 13:54:08 +0000 (13:54 +0000)]
Member constraints already covered all of E0482 already, so that error never occurred anymore

2 years agoGuarding a loop with a check that it never runs is useless
Oli Scherer [Thu, 30 Sep 2021 15:11:05 +0000 (15:11 +0000)]
Guarding a loop with a check that it never runs is useless

2 years agoRemove unused enum variant
Oli Scherer [Sat, 25 Sep 2021 12:06:29 +0000 (12:06 +0000)]
Remove unused enum variant

2 years agoRemove regionck member constraint handling and leave it to mir borrowck
Oli Scherer [Sat, 25 Sep 2021 11:49:14 +0000 (11:49 +0000)]
Remove regionck member constraint handling and leave it to mir borrowck

2 years agoRustWrapper: adapt for an LLVM API change
Krasimir Georgiev [Mon, 11 Oct 2021 10:31:43 +0000 (12:31 +0200)]
RustWrapper: adapt for an LLVM API change

No functional changes intended.

The LLVM commit
https://github.com/llvm/llvm-project/commit/89b57061f7b769e9ea9bf6ed686e284f3e55affe
moved TargetRegistry.(h|cpp) from Support to MC.
This adapts RustWrapper accordingly.

2 years agoAuto merge of #90000 - matthiaskrgr:rollup-vj7wwur, r=matthiaskrgr
bors [Mon, 18 Oct 2021 06:46:03 +0000 (06:46 +0000)]
Auto merge of #90000 - matthiaskrgr:rollup-vj7wwur, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #89950 (bootstrap: tweak verbosity settings)
 - #89965 (Fix ICE with `let...else` and `ref mut`)
 - #89974 (Nicer error message if the user attempts to do let...else if)
 - #89987 (Check implementing type for `#[doc(hidden)]`)
 - #89989 (rustdoc: Add static size assertion for `clean::Type`)
 - #89990 (rustc_span: `Ident::invalid` -> `Ident::empty`)
 - #89993 (Remove dead code from `compiletest::json`)
 - #89996 (Bump backtrace)

Failed merges:

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

2 years agoRollup merge of #89996 - winterqt:bump-backtrace, r=Mark-Simulacrum
Matthias Krüger [Mon, 18 Oct 2021 06:13:32 +0000 (08:13 +0200)]
Rollup merge of #89996 - winterqt:bump-backtrace, r=Mark-Simulacrum

Bump backtrace

https://github.com/rust-lang/backtrace-rs/pull/446 allows binaries built with Nix on macOS to be symbolized.

2 years agoRollup merge of #89993 - pierwill:patch-1, r=Mark-Simulacrum
Matthias Krüger [Mon, 18 Oct 2021 06:13:31 +0000 (08:13 +0200)]
Rollup merge of #89993 - pierwill:patch-1, r=Mark-Simulacrum

Remove dead code from `compiletest::json`

Currently getting a dead code warning on master. Might make sense to remove.

2 years agoRollup merge of #89990 - petrochenkov:idempty, r=wesleywiser
Matthias Krüger [Mon, 18 Oct 2021 06:13:30 +0000 (08:13 +0200)]
Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiser

rustc_span: `Ident::invalid` -> `Ident::empty`

The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.

2 years agoRollup merge of #89989 - camelid:type-size, r=jyn514
Matthias Krüger [Mon, 18 Oct 2021 06:13:29 +0000 (08:13 +0200)]
Rollup merge of #89989 - camelid:type-size, r=jyn514

rustdoc: Add static size assertion for `clean::Type`

r? `@jyn514`

2 years agoRollup merge of #89987 - pierwill:fix-85526-docs-hidden-assoc, r=GuillaumeGomez
Matthias Krüger [Mon, 18 Oct 2021 06:13:28 +0000 (08:13 +0200)]
Rollup merge of #89987 - pierwill:fix-85526-docs-hidden-assoc, r=GuillaumeGomez

Check implementing type for `#[doc(hidden)]`

Closes #85526.

2 years agoRollup merge of #89974 - est31:let_else_if_error, r=nagisa
Matthias Krüger [Mon, 18 Oct 2021 06:13:27 +0000 (08:13 +0200)]
Rollup merge of #89974 - est31:let_else_if_error, r=nagisa

Nicer error message if the user attempts to do let...else if

Gives a nice "conditional `else if` is not supported for `let...else`" error when encountering a `let...else if` pattern, as suggested in the [let...else tracking issue](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205).

2 years agoRollup merge of #89965 - JohnTitor:fix-let-else-ice-with-ref-mut, r=petrochenkov
Matthias Krüger [Mon, 18 Oct 2021 06:13:26 +0000 (08:13 +0200)]
Rollup merge of #89965 - JohnTitor:fix-let-else-ice-with-ref-mut, r=petrochenkov

Fix ICE with `let...else` and `ref mut`

Fixes #89960, opened for review.
I'm not satisfied with the current diagnostics, any ideas?

2 years agoRollup merge of #89950 - infinity0:master, r=Mark-Simulacrum
Matthias Krüger [Mon, 18 Oct 2021 06:13:25 +0000 (08:13 +0200)]
Rollup merge of #89950 - infinity0:master, r=Mark-Simulacrum

bootstrap: tweak verbosity settings

Currently the verbosity settings are:
- 2: RUSTC-SHIM envvars get spammed on every invocation, O(30) lines
     cargo is passed -v which outputs CLI invocations, O(5) lines
- 3: cargo is passed -vv which outputs build script output, O(0-10) lines

This commit changes it to:

- 1: cargo is passed -v, O(5) lines
- 2: cargo is passed -vv, O(10) lines
- 3: RUSTC-SHIM envvars get spammed, O(30) lines

2 years agobump backtrace
Winter [Mon, 18 Oct 2021 01:20:18 +0000 (21:20 -0400)]
bump backtrace

https://github.com/rust-lang/backtrace-rs/pull/446 allows binaries built
with Nix on macOS to be symbolized.

2 years agoRemove dead code from `compiletest::json`
pierwill [Sun, 17 Oct 2021 22:50:35 +0000 (17:50 -0500)]
Remove dead code from `compiletest::json`

2 years agoAuto merge of #89499 - Mark-Simulacrum:with-llvm-13, r=nikic
bors [Sun, 17 Oct 2021 22:29:31 +0000 (22:29 +0000)]
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.

2 years agoCheck implementing type for `#[doc(hidden)]`
pierwill [Sun, 17 Oct 2021 19:31:52 +0000 (14:31 -0500)]
Check implementing type for `#[doc(hidden)]`

Closes #85526.

2 years agoAdd static size assertion for `clean::Type`
Noah Lev [Sun, 17 Oct 2021 20:20:43 +0000 (13:20 -0700)]
Add static size assertion for `clean::Type`

2 years agoNicer error message if the user attempts to do let...else if
est31 [Sun, 17 Oct 2021 05:02:52 +0000 (07:02 +0200)]
Nicer error message if the user attempts to do let...else if

2 years agorustc_span: `Ident::invalid` -> `Ident::empty`
Vadim Petrochenkov [Sun, 17 Oct 2021 20:20:30 +0000 (23:20 +0300)]
rustc_span: `Ident::invalid` -> `Ident::empty`

The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.

2 years agoAuto merge of #89984 - matthiaskrgr:rollup-ikmyhmx, r=matthiaskrgr
bors [Sun, 17 Oct 2021 19:18:18 +0000 (19:18 +0000)]
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

2 years agoRollup merge of #89977 - woppopo:result_const_as_mut, r=oli-obk
Matthias Krüger [Sun, 17 Oct 2021 16:19:00 +0000 (18:19 +0200)]
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

2 years agoRollup merge of #89975 - JohnTitor:gats-tests-85921, r=jackh726
Matthias Krüger [Sun, 17 Oct 2021 16:18:59 +0000 (18:18 +0200)]
Rollup merge of #89975 - JohnTitor:gats-tests-85921, r=jackh726

Add a regression test for #85921

Closes #85921
r? `@jackh726`

2 years agoRollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisa
Matthias Krüger [Sun, 17 Oct 2021 16:18:59 +0000 (18:18 +0200)]
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

2 years agoRollup merge of #89946 - JohnTitor:fix-89686, r=petrochenkov
Matthias Krüger [Sun, 17 Oct 2021 16:18:58 +0000 (18:18 +0200)]
Rollup merge of #89946 - JohnTitor:fix-89686, r=petrochenkov

Fix an ICE with TAITs and Future

Fixes #89686

2 years agoRollup merge of #89945 - JohnTitor:we-now-specialize-clone-from-slice, r=the8472
Matthias Krüger [Sun, 17 Oct 2021 16:18:57 +0000 (18:18 +0200)]
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.

2 years agoRollup merge of #89888 - rusticstuff:download-ci-llvm-apple-arm64, r=Mark-Simulacrum
Matthias Krüger [Sun, 17 Oct 2021 16:18:56 +0000 (18:18 +0200)]
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.

2 years agoRollup merge of #89738 - eddyb:extern-crate-recursion, r=nagisa
Matthias Krüger [Sun, 17 Oct 2021 16:18:55 +0000 (18:18 +0200)]
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.

2 years agoAuto merge of #89981 - pietroalbini:1.56-version-bump, r=pietroalbini
bors [Sun, 17 Oct 2021 15:35:28 +0000 (15:35 +0000)]
Auto merge of #89981 - pietroalbini:1.56-version-bump, r=pietroalbini

Bump version to Rust 1.58.0

cc `@Mark-Simulacrum`
r? `@ghost`

2 years agobump version to rust 1.58.0
Pietro Albini [Sun, 17 Oct 2021 14:04:44 +0000 (16:04 +0200)]
bump version to rust 1.58.0

2 years agoAuto merge of #89514 - davidtwco:polymorphize-shims-and-predicates, r=lcnr
bors [Sun, 17 Oct 2021 12:33:12 +0000 (12:33 +0000)]
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`

2 years agoSome "parenthesis" and "parentheses" fixes
r00ster91 [Sun, 17 Oct 2021 10:04:01 +0000 (12:04 +0200)]
Some "parenthesis" and "parentheses" fixes

2 years agoMake Result::as_mut const
woppopo [Sat, 16 Oct 2021 16:18:00 +0000 (01:18 +0900)]
Make Result::as_mut const

2 years agoAuto merge of #88652 - AGSaidi:linux-aarch64-should-be-actually-monotonic, r=yaahc
bors [Sun, 17 Oct 2021 09:30:30 +0000 (09:30 +0000)]
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

255a3f3e183 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. 3914a7b0da8 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.

2 years agoAdd a regression test for #85921
Yuki Okushi [Sun, 17 Oct 2021 07:09:49 +0000 (16:09 +0900)]
Add a regression test for #85921

2 years agoAuto merge of #89968 - JohnTitor:rollup-z51n967, r=JohnTitor
bors [Sun, 17 Oct 2021 06:27:08 +0000 (06:27 +0000)]
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

2 years agoRollup merge of #89958 - nhamovitz:patch-1, r=nagisa
Yuki Okushi [Sat, 16 Oct 2021 22:52:22 +0000 (07:52 +0900)]
Rollup merge of #89958 - nhamovitz:patch-1, r=nagisa

Correct small typo

2 years agoRollup merge of #89953 - woppopo:option_const_as_mut, r=oli-obk
Yuki Okushi [Sat, 16 Oct 2021 22:52:21 +0000 (07:52 +0900)]
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

2 years agoRollup merge of #89943 - matthiaskrgr:clpcompl, r=oli-obk
Yuki Okushi [Sat, 16 Oct 2021 22:52:20 +0000 (07:52 +0900)]
Rollup merge of #89943 - matthiaskrgr:clpcompl, r=oli-obk

clippy::complexity fixes

2 years agoRollup merge of #89907 - GuillaumeGomez:correctly-emit-errors, r=camelid
Yuki Okushi [Sat, 16 Oct 2021 22:52:19 +0000 (07:52 +0900)]
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``

2 years agoRollup merge of #89886 - alexcrichton:update-wasi-libc, r=kennytm
Yuki Okushi [Sat, 16 Oct 2021 22:52:18 +0000 (07:52 +0900)]
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.

2 years agoRollup merge of #89849 - rusticstuff:remove-xcode-select, r=Mark-Simulacrum
Yuki Okushi [Sat, 16 Oct 2021 22:52:18 +0000 (07:52 +0900)]
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.

2 years agoRollup merge of #89507 - lopopolo:lopopolo/ordering-repr-i8, r=joshtriplett
Yuki Okushi [Sat, 16 Oct 2021 22:52:17 +0000 (07:52 +0900)]
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``

2 years agoFix ICE with `let...else` and `ref mut`
Yuki Okushi [Sat, 16 Oct 2021 22:12:22 +0000 (07:12 +0900)]
Fix ICE with `let...else` and `ref mut`

2 years agoCorrect typo
nhamovitz [Sat, 16 Oct 2021 20:36:05 +0000 (13:36 -0700)]
Correct typo

2 years agoRemove FIXME since there is nothing to be fixed.
Guillaume Gomez [Fri, 15 Oct 2021 19:37:31 +0000 (21:37 +0200)]
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.

2 years agoSuggest a case insensitive match name regardless of levenshtein distance
Yuki Okushi [Sat, 16 Oct 2021 19:51:22 +0000 (04:51 +0900)]
Suggest a case insensitive match name regardless of levenshtein distance

2 years agoAuto merge of #89860 - camsteffen:macro-semi, r=petrochenkov
bors [Sat, 16 Oct 2021 18:20:20 +0000 (18:20 +0000)]
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.

2 years agoclippy::complexity changes
Matthias Krüger [Sat, 16 Oct 2021 08:18:17 +0000 (10:18 +0200)]
clippy::complexity changes

2 years agoAdd `#![cfg_attr(bootstrap, feature(const_panic))]` to `library/core/tests/lib.rs`
woppopo [Sat, 16 Oct 2021 15:32:01 +0000 (00:32 +0900)]
Add `#![cfg_attr(bootstrap, feature(const_panic))]` to `library/core/tests/lib.rs`

2 years agoMake Option::as_mut const
woppopo [Sat, 16 Oct 2021 15:02:42 +0000 (00:02 +0900)]
Make Option::as_mut const

2 years agobootstrap: tweak verbosity settings
Ximin Luo [Sat, 16 Oct 2021 12:30:24 +0000 (13:30 +0100)]
bootstrap: tweak verbosity settings

Currently the verbosity settings are:
- 2: RUSTC-SHIM envvars get spammed on every invocation, O(30) lines
     cargo is passed -v which outputs CLI invocations, O(5) lines
- 3: cargo is passed -vv which outputs build script output, O(0-10) lines

This commit changes it to:

- 1: cargo is passed -v, O(5) lines
- 2: cargo is passed -vv, O(10) lines
- 3: RUSTC-SHIM envvars get spammed, O(30) lines

2 years agoFix an ICE with TAITs and Future
Yuki Okushi [Sat, 16 Oct 2021 09:30:37 +0000 (18:30 +0900)]
Fix an ICE with TAITs and Future

2 years agoRemove a mention to `copy_from_slice` from `clone_from_slice` doc
Yuki Okushi [Sat, 16 Oct 2021 08:30:34 +0000 (17:30 +0900)]
Remove a mention to `copy_from_slice` from `clone_from_slice` doc

2 years agoremove compiler warnings
Stefan Lankes [Sat, 16 Oct 2021 07:45:05 +0000 (09:45 +0200)]
remove compiler warnings

2 years agoHermitCore's kernel itself doesn't support TLS
Stefan Lankes [Sat, 16 Oct 2021 07:41:59 +0000 (09:41 +0200)]
HermitCore's kernel itself doesn't support TLS

HermitCore's kernel itself doesn't support TLS.
Consequently, the entries in x86_64-unknown-none-hermitkernel should be removed.
This commit should help to finalize #89062.

2 years agoAuto merge of #89939 - matthiaskrgr:rollup-q3lrdck, r=matthiaskrgr
bors [Sat, 16 Oct 2021 06:31:40 +0000 (06:31 +0000)]
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

2 years agoRollup merge of #89925 - gilescope:update-docs-atomic-usage, r=m-ou-se
Matthias Krüger [Sat, 16 Oct 2021 06:02:28 +0000 (08:02 +0200)]
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 )

2 years agoRollup merge of #89921 - joshuaseaton:zircon-process, r=tmandry
Matthias Krüger [Sat, 16 Oct 2021 06:02:27 +0000 (08:02 +0200)]
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.

2 years agoRollup merge of #89918 - JohnTitor:gats-tests, r=jackh726
Matthias Krüger [Sat, 16 Oct 2021 06:02:26 +0000 (08:02 +0200)]
Rollup merge of #89918 - JohnTitor:gats-tests, r=jackh726

Add some GATs related regression tests

Closes #88287, closes #88405

2 years agoRollup merge of #89915 - jackh726:outlives_cleanup, r=nikomatsakis
Matthias Krüger [Sat, 16 Oct 2021 06:02:25 +0000 (08:02 +0200)]
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````

2 years agoRollup merge of #89914 - jackh726:gat_genericboundfailure, r=estebank
Matthias Krüger [Sat, 16 Oct 2021 06:02:24 +0000 (08:02 +0200)]
Rollup merge of #89914 - jackh726:gat_genericboundfailure, r=estebank

Emit impl difference error for GenericBoundFailure too

Fixes #86787

r? ````@estebank````

2 years agoRollup merge of #89912 - davidtwco:issue-89280-split-lines-multiple-lines, r=oli-obk
Matthias Krüger [Sat, 16 Oct 2021 06:02:24 +0000 (08:02 +0200)]
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````

2 years agoRollup merge of #89906 - yuvaldolev:move-format-version-to-rustdoc-json-types, r...
Matthias Krüger [Sat, 16 Oct 2021 06:02:23 +0000 (08:02 +0200)]
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.

2 years agoRollup merge of #89902 - rusticstuff:outline-atomics-linux-only, r=workingjubilee
Matthias Krüger [Sat, 16 Oct 2021 06:02:22 +0000 (08:02 +0200)]
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`

2 years agoRollup merge of #89898 - Amanieu:remove_alloc_prelude, r=joshtriplett
Matthias Krüger [Sat, 16 Oct 2021 06:02:21 +0000 (08:02 +0200)]
Rollup merge of #89898 - Amanieu:remove_alloc_prelude, r=joshtriplett

Remove alloc::prelude

As per the libs team decision in #58935.

Closes #58935

2 years agoRollup merge of #89509 - jhpratt:stabilize-const_unreachable_unchecked, r=oli-obk
Matthias Krüger [Sat, 16 Oct 2021 06:02:20 +0000 (08:02 +0200)]
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)

2 years agoAuto merge of #85379 - mdaverde:uds-abstract, r=joshtriplett
bors [Fri, 15 Oct 2021 22:31:53 +0000 (22:31 +0000)]
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](https://github.com/rust-lang/rust/commit/c4db0685b181f12c4285dac3d932f1859bba74f5) [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!

2 years agoupdating docs to reflect current situation
Giles Cope [Fri, 15 Oct 2021 19:43:52 +0000 (20:43 +0100)]
updating docs to reflect current situation

2 years agoAuto merge of #84096 - m-ou-se:windows-bcrypt-random, r=dtolnay
bors [Fri, 15 Oct 2021 19:03:57 +0000 (19:03 +0000)]
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.

2 years agoDocument the new logic
Oli Scherer [Fri, 24 Sep 2021 17:48:06 +0000 (17:48 +0000)]
Document the new logic

2 years agoRemove a now-unused trait
Oli Scherer [Fri, 24 Sep 2021 17:44:32 +0000 (17:44 +0000)]
Remove a now-unused trait

2 years agoEquality of regions is not just on identity, but if both regions outlive each other
Oli Scherer [Fri, 24 Sep 2021 17:32:58 +0000 (17:32 +0000)]
Equality of regions is not just on identity, but if both regions outlive each other

2 years agoNormalize regions before comparing them for member constraints
Oli Scherer [Fri, 24 Sep 2021 17:32:30 +0000 (17:32 +0000)]
Normalize regions before comparing them for member constraints

2 years agoAdd some more instrumentation
Oli Scherer [Fri, 24 Sep 2021 17:31:32 +0000 (17:31 +0000)]
Add some more instrumentation

2 years agoRemove a now-unused struct
Oli Scherer [Fri, 24 Sep 2021 17:30:01 +0000 (17:30 +0000)]
Remove a now-unused struct

2 years agosimplify constrain_opaque_types
Niko Matsakis [Thu, 23 Sep 2021 15:21:01 +0000 (11:21 -0400)]
simplify constrain_opaque_types

2 years ago[fuchsia] Update process info struct
Joshua Seaton [Fri, 15 Oct 2021 17:24:52 +0000 (10:24 -0700)]
[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.

2 years agoAdd some GATs related regression tests
Yuki Okushi [Fri, 15 Oct 2021 16:38:49 +0000 (01:38 +0900)]
Add some GATs related regression tests

2 years agoMove some outlives bounds things from rustc_trait_selection to rustc_typeck
jackh726 [Fri, 15 Oct 2021 15:31:22 +0000 (11:31 -0400)]
Move some outlives bounds things from rustc_trait_selection to rustc_typeck

2 years agoUse LocalDefId directly in more places in wfcheck
jackh726 [Thu, 14 Oct 2021 02:22:09 +0000 (22:22 -0400)]
Use LocalDefId directly in more places in wfcheck

2 years agoMove push_outlives_components to rustc_infer
jackh726 [Sat, 9 Oct 2021 02:55:06 +0000 (22:55 -0400)]
Move push_outlives_components to rustc_infer

2 years agoAuto merge of #89337 - mbrubeck:vec-leak, r=m-ou-se
bors [Fri, 15 Oct 2021 15:55:08 +0000 (15:55 +0000)]
Auto merge of #89337 - mbrubeck:vec-leak, r=m-ou-se

Avoid allocations and copying in Vec::leak

The [`Vec::leak`] method (#62195) is currently implemented by calling `Vec::into_boxed_slice` and `Box::leak`.  This shrinks the vector before leaking it, which potentially causes a reallocation and copies the vector's contents.

By avoiding the conversion to `Box`, we can instead leak the vector without any expensive operations, just by returning a slice reference and forgetting the `Vec`.  Users who *want* to shrink the vector first can still do so by calling `shrink_to_fit` explicitly.

**Note:**  This could break code that uses `Box::from_raw` to “un-leak” the slice returned by `Vec::leak`.  However, the `Vec::leak` docs explicitly forbid this, so such code is already incorrect.

[`Vec::leak`]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.leak

2 years agoEmit impl difference error for GenericBoundFailure too
jackh726 [Tue, 5 Oct 2021 21:43:45 +0000 (17:43 -0400)]
Emit impl difference error for GenericBoundFailure too

2 years agoemitter: current substitution can be multi-line
David Wood [Fri, 15 Oct 2021 14:48:57 +0000 (14:48 +0000)]
emitter: current substitution can be multi-line

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.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoRework the equivalent test to work with sidebar-items.js
Loïc BRANSTETT [Fri, 15 Oct 2021 14:54:31 +0000 (16:54 +0200)]
Rework the equivalent test to work with sidebar-items.js

2 years agoAuto merge of #88717 - tabokie:vecdeque-fast-append, r=m-ou-se
bors [Fri, 15 Oct 2021 12:51:31 +0000 (12:51 +0000)]
Auto merge of #88717 - tabokie:vecdeque-fast-append, r=m-ou-se

Optimize VecDeque::append

Optimize `VecDeque::append` to do unsafe copy rather than iterating through each element.

On my `Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz`, the benchmark shows 37% improvements:
```
Master:
custom-bench vec_deque_append 583164 ns/iter
custom-bench vec_deque_append 550040 ns/iter

Patched:
custom-bench vec_deque_append 349204 ns/iter
custom-bench vec_deque_append 368164 ns/iter
```

Additional notes on the context: this is the third attempt to implement a non-trivial version of `VecDeque::append`, the last two are reverted due to unsoundness or regression, see:
- https://github.com/rust-lang/rust/pull/52553, reverted in https://github.com/rust-lang/rust/pull/53571
- https://github.com/rust-lang/rust/pull/53564, reverted in https://github.com/rust-lang/rust/pull/54851

Both cases are covered by existing tests.

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agoAdd missing bcrypt.lib to make-fulldeps Makefile.
Mara Bos [Fri, 15 Oct 2021 11:25:39 +0000 (13:25 +0200)]
Add missing bcrypt.lib to make-fulldeps Makefile.

2 years agoUse BCryptGenRandom instead of RtlGenRandom on Windows.
Mara Bos [Sun, 11 Apr 2021 12:55:47 +0000 (14:55 +0200)]
Use BCryptGenRandom instead of RtlGenRandom on Windows.

BCryptGenRandom isn't available on XP, but we dropped XP support a while
ago.

2 years agoAdd equivalent test in src/test/rustdoc
Loïc BRANSTETT [Fri, 15 Oct 2021 10:56:47 +0000 (12:56 +0200)]
Add equivalent test in src/test/rustdoc

2 years agoApply documentation suggestions from code review
Urgau [Fri, 15 Oct 2021 10:21:25 +0000 (12:21 +0200)]
Apply documentation suggestions from code review

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2 years agoAuto merge of #88540 - ibraheemdev:swap-unchecked, r=kennytm
bors [Fri, 15 Oct 2021 09:35:45 +0000 (09:35 +0000)]
Auto merge of #88540 - ibraheemdev:swap-unchecked, r=kennytm

add `slice::swap_unchecked`

An unsafe version of `slice::swap` that does not do bounds checking.

2 years agoMoved format-version constant to rustdoc-json-types
Yuval Dolev [Fri, 15 Oct 2021 09:27:42 +0000 (12:27 +0300)]
Moved format-version constant to rustdoc-json-types