Commit Graph

156398 Commits

Author SHA1 Message Date
Matthias Krüger a0724d72b0
Rollup merge of #89988 - tmiasko:unpromote-const-drop, r=oli-obk
Do not promote values with const drop that need to be dropped

Changes from #88558 allowed using `~const Drop` in constants by
introducing a new `NeedsNonConstDrop` qualif.

The new qualif was also used for promotion purposes, and allowed
promotion to happen for values that needs to be dropped but which
do have a const drop impl.

Since for promoted the drop implementation is never executed,
this lead to observable change in behaviour. For example:

```rust

struct Panic();

impl const Drop for Panic {
    fn drop(&mut self) {
        panic!();
    }
}

fn main() {
    let _ = &Panic();
}
```

Restore the use of `NeedsDrop` qualif during promotion to avoid the issue.
2021-10-19 05:40:54 +02:00
Matthias Krüger 8c8835d277
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``
2021-10-19 05:40:53 +02:00
Matthias Krüger 9dccb7bd89
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.
2021-10-19 05:40:52 +02:00
Matthias Krüger 0d990a3dbd
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
2021-10-19 05:40:51 +02:00
Matthias Krüger 54aa5477ac
Rollup merge of #89766 - krasimirgg:llvm-14-targetregistrty, r=nagisa
RustWrapper: adapt for an LLVM API change

No functional changes intended.

The LLVM commit
89b57061f7
moved TargetRegistry.(h|cpp) from Support to MC.
This adapts RustWrapper accordingly.
2021-10-19 05:40:50 +02:00
bors ec724ac075 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.
2021-10-18 23:02:53 +00:00
Tomasz Miąsko 915a581bcb Do not promote values with const drop that need to be dropped
Changes from #88558 allowed using `~const Drop` in constants by
introducing a new `NeedsNonConstDrop` qualif.

The new qualif was also used for promotion purposes, and allowed
promotion to happen for values that needs to be dropped but which
do have a const drop impl.

Since for promoted the drop implementation is never executed,
this lead to observable change in behaviour. For example:

```rust

struct Panic();

impl const Drop for Panic {
    fn drop(&mut self) {
        panic!();
    }
}

fn main() {
    let _ = &Panic();
}
```

Restore the use of `NeedsDrop` qualif during promotion to avoid the issue.
2021-10-18 21:56:57 +02:00
bors bd41e09da3 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`
2021-10-18 19:53:05 +00:00
Tomasz Miąsko 171cbc01ef Rename `needs_drop` to `needs_non_const_drop` 2021-10-18 20:51:22 +02:00
Oli Scherer 4413f8c709 Member constraints already covered all of E0482 already, so that error never occurred anymore 2021-10-18 15:50:56 +00:00
Oli Scherer 2220fafa8c Guarding a loop with a check that it never runs is useless 2021-10-18 15:50:56 +00:00
Oli Scherer 2431540b62 Remove unused enum variant 2021-10-18 15:50:56 +00:00
Oli Scherer b02f2982e7 Remove regionck member constraint handling and leave it to mir borrowck 2021-10-18 15:50:56 +00:00
Krasimir Georgiev e3c3f4a09c RustWrapper: adapt for an LLVM API change
No functional changes intended.

The LLVM commit
89b57061f7
moved TargetRegistry.(h|cpp) from Support to MC.
This adapts RustWrapper accordingly.
2021-10-18 09:48:47 +02:00
bors 5dab47dcd8 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
2021-10-18 06:46:03 +00:00
Matthias Krüger 2724b00065
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.
2021-10-18 08:13:32 +02:00
Matthias Krüger adde016d38
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.
2021-10-18 08:13:31 +02:00
Matthias Krüger 2fd765c1d9
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.
2021-10-18 08:13:30 +02:00
Matthias Krüger 874f19f462
Rollup merge of #89989 - camelid:type-size, r=jyn514
rustdoc: Add static size assertion for `clean::Type`

r? `@jyn514`
2021-10-18 08:13:29 +02:00
Matthias Krüger cd72393566
Rollup merge of #89987 - pierwill:fix-85526-docs-hidden-assoc, r=GuillaumeGomez
Check implementing type for `#[doc(hidden)]`

Closes #85526.
2021-10-18 08:13:28 +02:00
Matthias Krüger 5898c5d88e
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).
2021-10-18 08:13:27 +02:00
Matthias Krüger b356a04c9a
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?
2021-10-18 08:13:26 +02:00
Matthias Krüger b902aa98e5
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
2021-10-18 08:13:25 +02:00
Winter 3f87b7cc0b bump backtrace
https://github.com/rust-lang/backtrace-rs/pull/446 allows binaries built
with Nix on macOS to be symbolized.
2021-10-17 21:20:18 -04:00
pierwill b87a0b06c7
Remove dead code from `compiletest::json` 2021-10-17 17:50:35 -05: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
pierwill d39a1bec81 Check implementing type for `#[doc(hidden)]`
Closes #85526.
2021-10-17 16:37:44 -05:00
Noah Lev 10b9b3d383 Add static size assertion for `clean::Type` 2021-10-17 14:30:53 -07:00
est31 856541963c Nicer error message if the user attempts to do let...else if 2021-10-17 22:56:29 +02:00
Vadim Petrochenkov a6808335d4 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.
2021-10-17 23:20:30 +03: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