]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #98879 - compiler-errors:async-closure-wrap-parens, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:13 +0000 (23:11 +0200)]
Rollup merge of #98879 - compiler-errors:async-closure-wrap-parens, r=oli-obk

Fix "wrap closure in parenthesis" suggestion for `async` closure

Fixes #98023

2 years agoRollup merge of #98878 - lcnr:more-rustc_pass_by_value, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:12 +0000 (23:11 +0200)]
Rollup merge of #98878 - lcnr:more-rustc_pass_by_value, r=oli-obk

add more `rustc_pass_by_value`

r? ```@oli-obk``` cc #98766

2 years agoRollup merge of #98814 - fmease:minimal-fix-for-issue-97933, r=GuillaumeGomez
Matthias Krüger [Mon, 4 Jul 2022 21:11:11 +0000 (23:11 +0200)]
Rollup merge of #98814 - fmease:minimal-fix-for-issue-97933, r=GuillaumeGomez

rustdoc: Censor certain complex unevaluated const exprs

Fixes #97933.

This is more of a hotfix for the aforementioned issue. By that, I mean that my proposed patch is
not the best solution but one that does not change as much existing code.
It treats symptoms rather than the root cause.

This PR “censors” certain complex unevaluated constant expressions like `match`es, blocks, function calls, struct literals etc. by pretty-printing them as `_` / `{ _ }` (number and string literals, paths and `()` are still printed as one would expect).
Resorting to this placeholder is preferable to printing the full expression verbatim since
they can be quite large and verbose resulting in an unreadable mess in the generated documentation.
Further, mindlessly printing the const would leak private and `doc(hidden)` struct fields (#97933), at least in the current
stable & nightly implementations which rely on `span_to_snippet` (!) and `rustc_hir_pretty::id_to_string`.

The censoring of _verbose_ expressions is probably going to stay longer term.
However, in regards to private and `doc(hidden)` struct fields, I have a more proper fix in mind
which I have already partially implemented locally and for which I am going to open a separate PR sometime soon.
For that, I was already in contact with `@GuillaumeGomez.`
The proper fix involves rustdoc not falling back on pretty-printing unevaluated consts so easily (what this PR is concerned about)
and instead preferring to print evaluated consts which contain more information allowing it to selectively hide private and `doc(hidden)` fields, create hyperlinks etc. generally making the output more granular and precise (compared to the brutal `_` placeholder).

Unfortunately, I was a bit too late and the issue just hit stable (1.62).
Should this be backported to beta or even a potential 1.62.1?

r? `@GuillaumeGomez`

2 years agoRollup merge of #98793 - Mark-Simulacrum:fix-tidy-bins, r=jyn514
Matthias Krüger [Mon, 4 Jul 2022 21:11:10 +0000 (23:11 +0200)]
Rollup merge of #98793 - Mark-Simulacrum:fix-tidy-bins, r=jyn514

Lint against executable files in the root directory

This avoids accidental introduction (such as in #97488) of executable files into the root directory, not just under library/, src/ or compiler/.

Resolves #98792

2 years agoRollup merge of #98782 - compiler-errors:specialization-error-span, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:09 +0000 (23:11 +0200)]
Rollup merge of #98782 - compiler-errors:specialization-error-span, r=oli-obk

Improve spans for specialization error

Fixes #98777

2 years agoRollup merge of #98738 - tmiasko:checked-binop, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:07 +0000 (23:11 +0200)]
Rollup merge of #98738 - tmiasko:checked-binop, r=oli-obk

Clarify MIR semantics of checked binary operations

2 years agorustdoc: censor certain complex unevaluated const exprs
León Orell Valerian Liehr [Thu, 23 Jun 2022 15:19:56 +0000 (17:19 +0200)]
rustdoc: censor certain complex unevaluated const exprs

2 years agoAuto merge of #98573 - krasimirgg:nlmb-llvm-nm, r=nikic
bors [Mon, 4 Jul 2022 15:59:44 +0000 (15:59 +0000)]
Auto merge of #98573 - krasimirgg:nlmb-llvm-nm, r=nikic

adapt native-link-modifier-bundle test to use llvm-nm

No functional changes intended.

This updates the test case to use `llvm-nm` as an alternative to https://github.com/rust-lang/rust/pull/98424.

This fixes a test failure over at the experimental build of rustc with HEAD LLVM:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/11144#01814d0f-a46a-4c19-91cf-41e720edb6f9/684-691.

The issue is that this test uses the system nm, which may not be recent
enough to understand the bitcode produced by rustc when compiled against HEAD LLVM.

Similar to what we did for another test in https://github.com/rust-lang/rust/pull/94023.

2 years agoadapt native-link-modifier-bundle test to use llvm-nm
Krasimir Georgiev [Wed, 29 Jun 2022 08:41:32 +0000 (08:41 +0000)]
adapt native-link-modifier-bundle test to use llvm-nm

2 years agoAuto merge of #98817 - the8472:dont-optimize-ui-tests, r=Mark-Simulacrum
bors [Mon, 4 Jul 2022 12:32:39 +0000 (12:32 +0000)]
Auto merge of #98817 - the8472:dont-optimize-ui-tests, r=Mark-Simulacrum

Only obey optimize-tests flag on UI tests that are run-pass

stage1 UI tests walltime on my machine:

```
optimize-tests = false, master
25.98s

optimize-tests = true, master
34.69s

optimize-tests = true, patched
28.79s
```

Effects:

- faster UI tests
- llvm asserts get exercised less on build-pass tests
- the difference between opt and nopt builds shrinks a bit
- aux libs don't get optimized since they don't have a pass mode and almost never have explicit compile flags

2 years agoAuto merge of #98641 - lcnr:mir-dropck, r=oli-obk
bors [Mon, 4 Jul 2022 09:23:01 +0000 (09:23 +0000)]
Auto merge of #98641 - lcnr:mir-dropck, r=oli-obk

fully move dropck to mir

r? `@oli-obk`

2 years agofully move dropck to mir
lcnr [Tue, 28 Jun 2022 20:56:32 +0000 (22:56 +0200)]
fully move dropck to mir

2 years agoFix wrap parenthesis suggestion for async closure
Michael Goulet [Mon, 4 Jul 2022 08:07:12 +0000 (08:07 +0000)]
Fix wrap parenthesis suggestion for async closure

2 years agomore `rustc_pass_by_value`
lcnr [Mon, 4 Jul 2022 07:40:58 +0000 (09:40 +0200)]
more `rustc_pass_by_value`

2 years agoAuto merge of #98874 - matthiaskrgr:rollup-0u4hm54, r=matthiaskrgr
bors [Mon, 4 Jul 2022 06:35:29 +0000 (06:35 +0000)]
Auto merge of #98874 - matthiaskrgr:rollup-0u4hm54, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #98501 (rustc_passes/src/entry.rs: De-duplicate more code with `fn throw_attr_err()`)
 - #98774 (rustdoc: make source sidebar toggle a real button)
 - #98806 (Fix long declaration trailing whitespace)
 - #98823 (Fix rust-call ICE in mir-inliner)
 - #98870 (Add regression test for #86784)

Failed merges:

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

2 years agoRollup merge of #98870 - TaKO8Ki:add-regression-test-for-86784, r=compiler-errors
Matthias Krüger [Mon, 4 Jul 2022 04:08:11 +0000 (06:08 +0200)]
Rollup merge of #98870 - TaKO8Ki:add-regression-test-for-86784, r=compiler-errors

Add regression test for #86784

closes #86784

2 years agoRollup merge of #98823 - compiler-errors:rust-call-mir-inline, r=cjgillot
Matthias Krüger [Mon, 4 Jul 2022 04:08:10 +0000 (06:08 +0200)]
Rollup merge of #98823 - compiler-errors:rust-call-mir-inline, r=cjgillot

Fix rust-call ICE in mir-inliner

Fixes #98821
r? ``@cjgillot``

2 years agoRollup merge of #98806 - GuillaumeGomez:decl-trailing-whitespace, r=notriddle
Matthias Krüger [Mon, 4 Jul 2022 04:08:09 +0000 (06:08 +0200)]
Rollup merge of #98806 - GuillaumeGomez:decl-trailing-whitespace, r=notriddle

Fix long declaration trailing whitespace

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

Interestingly enough, it even simplifies the code a bit.

r? `@notriddle`

2 years agoRollup merge of #98774 - notriddle:notriddle/source-code-sidebar-button, r=GuillaumeGomez
Matthias Krüger [Mon, 4 Jul 2022 04:08:08 +0000 (06:08 +0200)]
Rollup merge of #98774 - notriddle:notriddle/source-code-sidebar-button, r=GuillaumeGomez

rustdoc: make source sidebar toggle a real button

This fixes tab focus, so that you can open and close the sidebar from keyboard.

This should cause no visible change in appearance at all. The only way you'd know anything different is if you tried to use keyboard controls to open the source code file navigation sidebar.

Separated out from #98772

2 years agoRollup merge of #98501 - Enselic:err_if_attr_found, r=compiler-errors
Matthias Krüger [Mon, 4 Jul 2022 04:08:07 +0000 (06:08 +0200)]
Rollup merge of #98501 - Enselic:err_if_attr_found, r=compiler-errors

rustc_passes/src/entry.rs: De-duplicate more code with `fn throw_attr_err()`

So we can more easily re-use the code for other attributes later. More specifically [`#[unix_sigpipe]`](https://github.com/rust-lang/rust/pull/97802). This refactoring is covered by this test:
https://github.com/rust-lang/rust/blob/8aab472d52ba7314dc193c73abcd384e2586123c/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs#L120
(Well, only `#[start]`, but the code for `#[rustc_main]` is identical.)

2 years agoAuto merge of #98731 - InfRandomness:fix-#98728, r=Mark-Simulacrum
bors [Mon, 4 Jul 2022 03:54:47 +0000 (03:54 +0000)]
Auto merge of #98731 - InfRandomness:fix-#98728, r=Mark-Simulacrum

Revert #95993 fix

This reverts the temporary fix implemented by https://github.com/rust-lang/rust/pull/95993 since a permanent fix has been implemented by https://github.com/rust-lang/cargo/pull/10594

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

2 years agoadd regression test for #86784
Takayuki Maeda [Mon, 4 Jul 2022 02:07:13 +0000 (11:07 +0900)]
add regression test for #86784

2 years agoAuto merge of #98446 - nnethercote:derive-no-match-destructuring, r=scottmcm
bors [Mon, 4 Jul 2022 01:06:54 +0000 (01:06 +0000)]
Auto merge of #98446 - nnethercote:derive-no-match-destructuring, r=scottmcm

Don't use match-destructuring for derived ops on structs.

r? `@scottmcm`

2 years agoDon't use match-destructuring for derived ops on structs.
Nicholas Nethercote [Fri, 24 Jun 2022 00:20:54 +0000 (10:20 +1000)]
Don't use match-destructuring for derived ops on structs.

All derive ops currently use match-destructuring to access fields. This
is reasonable for enums, but sub-optimal for structs. E.g.:
```
fn eq(&self, other: &Point) -> bool {
    match *other {
Self { x: ref __self_1_0, y: ref __self_1_1 } =>
    match *self {
Self { x: ref __self_0_0, y: ref __self_0_1 } =>
    (*__self_0_0) == (*__self_1_0) &&
(*__self_0_1) == (*__self_1_1),
    },
    }
}
```
This commit changes derive ops on structs to use field access instead, e.g.:
```
fn eq(&self, other: &Point) -> bool {
    self.x == other.x && self.y == other.y
}
```
This is faster to compile, results in smaller binaries, and is simpler to
generate. Unfortunately, we have to keep the old pattern generating code around
for `repr(packed)` structs because something like `&self.x` (which doesn't show
up in `PartialEq` ops, but does show up in `Debug` and `Hash` ops) isn't
allowed. But this commit at least changes those cases to use let-destructuring
instead of match-destructuring, e.g.:
```
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
    {
let Self(ref __self_0_0) = *self;
{ ::core::hash::Hash::hash(&(*__self_0_0), state) }
    }
}
```
There are some unnecessary blocks remaining in the generated code, but I
will fix them in a follow-up PR.

2 years agoComment fixes.
Nicholas Nethercote [Thu, 23 Jun 2022 22:31:00 +0000 (08:31 +1000)]
Comment fixes.

Remove an out-of-date sentence, and fix a typo.

2 years agoAdd an interesting case to the `deriving-all-codegen.rs` test.
Nicholas Nethercote [Fri, 24 Jun 2022 04:06:35 +0000 (14:06 +1000)]
Add an interesting case to the `deriving-all-codegen.rs` test.

2 years agoAuto merge of #98864 - RalfJung:rollup-ptzklyc, r=RalfJung
bors [Sun, 3 Jul 2022 22:20:10 +0000 (22:20 +0000)]
Auto merge of #98864 - RalfJung:rollup-ptzklyc, r=RalfJung

Rollup of 4 pull requests

Successful merges:

 - #94831 (Link to stabilization section in std-dev-guide for library tracking issue template)
 - #98764 (add Miri to the nightly docs)
 - #98773 (rustdoc: use <details> tag for the source code sidebar)
 - #98799 (Fix bug in `rustdoc -Whelp`)

Failed merges:

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

2 years agoRollup merge of #98799 - jyn514:rustdoc-lint-help, r=GuillaumeGomez
Ralf Jung [Sun, 3 Jul 2022 20:41:57 +0000 (16:41 -0400)]
Rollup merge of #98799 - jyn514:rustdoc-lint-help, r=GuillaumeGomez

Fix bug in `rustdoc -Whelp`

Previously, this printed the debugging options, not the lint options,
and only handled `-Whelp`, not `-A/-D/-F`.

This also fixes a few other misc issues:
- Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests
- Add lint headers for tool lints, not just builtin lints

https://github.com/rust-lang/rust/pull/98533#issuecomment-1172004197

r? ```@GuillaumeGomez```

2 years agoRollup merge of #98773 - notriddle:notriddle/source-sidebar-details, r=GuillaumeGomez
Ralf Jung [Sun, 3 Jul 2022 20:41:56 +0000 (16:41 -0400)]
Rollup merge of #98773 - notriddle:notriddle/source-sidebar-details, r=GuillaumeGomez

rustdoc: use <details> tag for the source code sidebar

This fixes the extremely poor accessibility of the old system, making it possible to navigate the sidebar by keyboard, and also implicitly gives the sidebar items the correct ARIA roles.

Split out separately from #98772

2 years agoRollup merge of #98764 - InfRandomness:miri-rustdoc, r=jyn514
Ralf Jung [Sun, 3 Jul 2022 20:41:54 +0000 (16:41 -0400)]
Rollup merge of #98764 - InfRandomness:miri-rustdoc, r=jyn514

add Miri to the nightly docs

This is a follow-up to https://github.com/rust-lang/rust/pull/97773 and to https://github.com/rust-lang/rust/pull/98714

It adds miri to the doc.rust-lang.org/nightly/nightly-rustc](https://doc.rust-lang.org/nightly/nightly-rustc/

2 years agoRollup merge of #94831 - yaahc:lib-tracking-issue-template-update, r=JohnTitor
Ralf Jung [Sun, 3 Jul 2022 20:41:53 +0000 (16:41 -0400)]
Rollup merge of #94831 - yaahc:lib-tracking-issue-template-update, r=JohnTitor

Link to stabilization section in std-dev-guide for library tracking issue template

This shouldn't land until https://github.com/rust-lang/std-dev-guide/pull/32 is merged.

2 years agoignore rustdoc failures for out-of-tree tools
Ralf Jung [Thu, 30 Jun 2022 14:41:04 +0000 (10:41 -0400)]
ignore rustdoc failures for out-of-tree tools

2 years agoAdd in_tree macro literal
InfRandomness [Mon, 6 Jun 2022 15:21:39 +0000 (17:21 +0200)]
Add in_tree macro literal

Signed-off-by: InfRandomness <infrandomness@gmail.com>
2 years agoAdd miri to the rustc docs.rs page
InfRandomness [Sun, 5 Jun 2022 21:33:39 +0000 (23:33 +0200)]
Add miri to the rustc docs.rs page

This adds miri to https://doc.rust-lang.org/nightly/nightly-rustc/

Signed-off-by: InfRandomness <infrandomness@gmail.com>
2 years agoAuto merge of #98439 - ehuss:cleanup-ci-script, r=Mark-Simulacrum
bors [Sun, 3 Jul 2022 19:39:28 +0000 (19:39 +0000)]
Auto merge of #98439 - ehuss:cleanup-ci-script, r=Mark-Simulacrum

Clean up submodule checkout scripts

This is just some small cleanup:

* Removed unused CACHE_DIR stuff
* Removed duplicate fetch_github_commit_archive function which is no longer used
* Combined init_repo.sh and checkout-submodules.sh, as checkout-submodules.sh was doing nothing but calling init_repo.sh

2 years agoRemove redundant pseudo-class
Michael Howell [Sun, 3 Jul 2022 18:42:44 +0000 (11:42 -0700)]
Remove redundant pseudo-class

2 years agoAdd test for trailing whitespace in long declaration
Guillaume Gomez [Sat, 2 Jul 2022 10:43:33 +0000 (12:43 +0200)]
Add test for trailing whitespace in long declaration

2 years agoAuto merge of #98373 - joshtriplett:bootstrap-locking, r=jyn514
bors [Sun, 3 Jul 2022 16:29:09 +0000 (16:29 +0000)]
Auto merge of #98373 - joshtriplett:bootstrap-locking, r=jyn514

Move locking from bootstrap.py to rust bootstrap, using fd-lock

Helps with https://github.com/rust-lang/rust/issues/94829.

2 years agoAuto merge of #97437 - jyn514:impl-asrawfd-arc, r=dtolnay
bors [Sun, 3 Jul 2022 12:17:19 +0000 (12:17 +0000)]
Auto merge of #97437 - jyn514:impl-asrawfd-arc, r=dtolnay

`impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>`

This allows implementing traits that require a raw FD on Arc and Box.

Previously, you'd have to add the function to the trait itself:

```rust
trait MyTrait {
    fn as_raw_fd(&self) -> RawFd;
}

impl<T: MyTrait> MyTrait for Arc<T> {
    fn as_raw_fd(&self) -> RawFd {
        (**self).as_raw_fd()
    }
}
```

In particular, this leads to lots of "multiple applicable items in scope" errors because you have to disambiguate `MyTrait::as_raw_fd` from `AsRawFd::as_raw_fd` at each call site. In generic contexts, when passing the type to a function that takes `impl AsRawFd` it's also sometimes required to use `T: MyTrait + AsRawFd`, which wouldn't be necessary if I could write `MyTrait: AsRawFd`.

After this PR, the code can be simpler:
```rust
trait MyTrait: AsRawFd {}

impl<T: MyTrait> MyTrait for Arc<T> {}
```

2 years agoAuto merge of #98755 - nnethercote:faster-vec-insert, r=cuviper
bors [Sun, 3 Jul 2022 09:36:37 +0000 (09:36 +0000)]
Auto merge of #98755 - nnethercote:faster-vec-insert, r=cuviper

Optimize `Vec::insert` for the case where `index == len`.

By skipping the call to `copy` with a zero length. This makes it closer
to `push`.

I did this recently for `SmallVec`
(https://github.com/servo/rust-smallvec/pull/282) and it was a big perf win in
one case. Although I don't have a specific use case in mind, it seems
worth doing it for `Vec` as well.

Things to note:
- In the `index < len` case, the number of conditions checked is
  unchanged.
- In the `index == len` case, the number of conditions checked increases
  by one, but the more expensive zero-length copy is avoided.
- In the `index > len` case the code now reserves space for the extra
  element before panicking. This seems like an unimportant change.

r? `@cuviper`

2 years agoAuto merge of #98673 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
bors [Sun, 3 Jul 2022 06:55:50 +0000 (06:55 +0000)]
Auto merge of #98673 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum

Bump bootstrap compiler

r? `@Mark-Simulacrum`

2 years agoAuto merge of #98570 - SparrowLii:deadlock, r=cjgillot
bors [Sun, 3 Jul 2022 02:05:14 +0000 (02:05 +0000)]
Auto merge of #98570 - SparrowLii:deadlock, r=cjgillot

get rid of `tcx` in deadlock handler when parallel compilation

This is a very obscure and hard-to-trace problem that affects thread scheduling. If we copy `tcx` to the deadlock handler thread, it will perform unpredictable behavior and cause very weird problems when executing `try_collect_active_jobs`(For example, the deadlock handler thread suddenly preempts the content of the blocked worker thread and executes the unknown judgment branch, like #94654).
Fortunately we can avoid this behavior by precomputing `query_map`. This change fixes the following ui tests failure on my environment when set `parallel-compiler = true`:
```
    [ui] src/test\ui\async-await\no-const-async.rs
    [ui] src/test\ui\infinite\infinite-struct.rs
    [ui] src/test\ui\infinite\infinite-tag-type-recursion.rs
    [ui] src/test\ui\issues\issue-3008-1.rs
    [ui] src/test\ui\issues\issue-3008-2.rs
    [ui] src/test\ui\issues\issue-32326.rs
    [ui] src/test\ui\issues\issue-57271.rs
    [ui] src/test\ui\issues\issue-72554.rs
    [ui] src/test\ui\parser\fn-header-semantic-fail.rs
    [ui] src/test\ui\union\union-nonrepresentable.rs
```

Updates #75760
Fixes #94654

2 years agoAuto merge of #98569 - nnethercote:finalize_resolutions_id, r=cjgillot
bors [Sat, 2 Jul 2022 23:38:08 +0000 (23:38 +0000)]
Auto merge of #98569 - nnethercote:finalize_resolutions_id, r=cjgillot

Avoid unnecessary work in `finalize_resolutions_in`.

If `module.opt_def_id()` returns `None`, we can skip most of the work.

r? `@lqd`

2 years agoFix rust-call ICE in mir-inliner
Michael Goulet [Sat, 2 Jul 2022 21:40:33 +0000 (21:40 +0000)]
Fix rust-call ICE in mir-inliner

2 years agomove optimize-tests flag handling from bootstrap to compiletest
The 8472 [Sat, 2 Jul 2022 20:19:49 +0000 (22:19 +0200)]
move optimize-tests flag handling from bootstrap to compiletest

2 years agoAuto merge of #98820 - RalfJung:rollup-i3mip9a, r=RalfJung
bors [Sat, 2 Jul 2022 19:46:01 +0000 (19:46 +0000)]
Auto merge of #98820 - RalfJung:rollup-i3mip9a, r=RalfJung

Rollup of 6 pull requests

Successful merges:

 - #98701 (Add regression test for #50439)
 - #98715 (add ice test for #97047)
 - #98753 (Fix `x dist rust-dev` on a fresh checkout)
 - #98805 (Add #95469 to the release notes)
 - #98812 (feat: Add a documentation problem issue template)
 - #98819 (update Miri)

Failed merges:

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

2 years agoRollup merge of #98819 - RalfJung:miri, r=RalfJung
Ralf Jung [Sat, 2 Jul 2022 19:21:21 +0000 (15:21 -0400)]
Rollup merge of #98819 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/98779
r? `@ghost`

2 years agoRollup merge of #98812 - gimbles:docs-template, r=Mark-Simulacrum
Ralf Jung [Sat, 2 Jul 2022 19:21:20 +0000 (15:21 -0400)]
Rollup merge of #98812 - gimbles:docs-template, r=Mark-Simulacrum

feat: Add a documentation problem issue template

Fixes #98722 :)

2 years agoRollup merge of #98805 - ChrisDenton:rel-notes, r=Dylan-DPC
Ralf Jung [Sat, 2 Jul 2022 19:21:19 +0000 (15:21 -0400)]
Rollup merge of #98805 - ChrisDenton:rel-notes, r=Dylan-DPC

Add #95469 to the release notes

#95469 may break programs using async file handles so it should've been noted in compatibility notes (sorry).

2 years agoRollup merge of #98753 - jyn514:dist-rust-dev, r=Mark-Simulacrum
Ralf Jung [Sat, 2 Jul 2022 19:21:18 +0000 (15:21 -0400)]
Rollup merge of #98753 - jyn514:dist-rust-dev, r=Mark-Simulacrum

Fix `x dist rust-dev` on a fresh checkout

Previously, it required you to manually run `x build` first, because it
assumed the LLVM binaries were already present.

2 years agoRollup merge of #98715 - matthiaskrgr:test_97047, r=Mark-Simulacrum
Ralf Jung [Sat, 2 Jul 2022 19:21:17 +0000 (15:21 -0400)]
Rollup merge of #98715 - matthiaskrgr:test_97047, r=Mark-Simulacrum

add ice test for #97047

Fixes #97047

2 years agoRollup merge of #98701 - TaKO8Ki:add-regression-test-for-50439, r=Mark-Simulacrum
Ralf Jung [Sat, 2 Jul 2022 19:21:16 +0000 (15:21 -0400)]
Rollup merge of #98701 - TaKO8Ki:add-regression-test-for-50439, r=Mark-Simulacrum

Add regression test for #50439

closes #50439

2 years agoupdate Miri
Ralf Jung [Sat, 2 Jul 2022 19:15:56 +0000 (15:15 -0400)]
update Miri

2 years agoOnly obey optimize-tests flag on UI tests that are run-pass
The 8472 [Sat, 2 Jul 2022 18:50:55 +0000 (20:50 +0200)]
Only obey optimize-tests flag on UI tests that are run-pass

```
optimize-tests = false, master
25.98s

optimize-tests = true, master
34.69s

optimize-tests = true, patched
28.79s
```

Effects:

- faster UI tests
- llvm asserts get exercised less on build-pass tests
- the difference between opt and nopt builds shrinks a bit
- aux libs don't get optimized since they don't have a pass mode and almost never have explicit compile flags

2 years agoAuto merge of #97585 - lqd:const-alloc-intern, r=RalfJung
bors [Sat, 2 Jul 2022 17:05:13 +0000 (17:05 +0000)]
Auto merge of #97585 - lqd:const-alloc-intern, r=RalfJung

CTFE interning: don't walk allocations that don't need it

The interning of const allocations visits the mplace looking for references to intern. Walking big aggregates like big static arrays can be costly, so we only do it if the allocation we're interning contains references or interior mutability.

Walking ZSTs was avoided before, and this optimization is now applied to cases where there are no references/relocations either.

---

While initially looking at this in the context of #93215, I've been testing with smaller allocations than the 16GB one in that issue, and with different init/uninit patterns (esp. via padding).

In that example, by default, `eval_to_allocation_raw` is the heaviest query followed by `incr_comp_serialize_result_cache`. So I'll show numbers when incremental compilation is disabled, to focus on the const allocations themselves at 95% of the compilation time, at bigger array sizes on these minimal examples like `static ARRAY: [u64; LEN] = [0; LEN];`.

That is a close construction to parts of the `ctfe-stress-test-5` benchmark, which has const allocations in the megabytes, while most crates usually have way smaller ones. This PR will have the most impact in these situations, as the walk during the interning starts to dominate the runtime.

Unicode crates (some of which are present in our benchmarks) like `ucd`, `encoding_rs`, etc come to mind as having bigger than usual allocations as well, because of big tables of code points (in the hundreds of KB, so still an order of magnitude or 2 less than the stress test).

In a check build, for a single static array shown above, from 100 to 10^9 u64s (for lengths in powers of ten), the constant factors are lowered:

(log scales for easier comparisons)
![plot_log](https://user-images.githubusercontent.com/247183/171422958-16f1ea19-3ed4-4643-812c-1c7c60a97e19.png)

(linear scale for absolute diff at higher Ns)
![plot_linear](https://user-images.githubusercontent.com/247183/171401886-2a869a4d-5cd5-47d3-9a5f-8ce34b7a6917.png)

For one of the alternatives of that issue
```rust
const ROWS: usize = 100_000;
const COLS: usize = 10_000;

static TWODARRAY: [[u128; COLS]; ROWS] = [[0; COLS]; ROWS];
```

we can see a similar reduction of around 3x (from 38s to 12s or so).

For the same size, the slowest case IIRC is when there are uninitialized bytes e.g. via padding

```rust
const ROWS: usize = 100_000;
const COLS: usize = 10_000;

static TWODARRAY: [[(u64, u8); COLS]; ROWS] = [[(0, 0); COLS]; ROWS];
```
then interning/walking does not dominate anymore (but means there is likely still some interesting work left to do here).

Compile times in this case rise up quite a bit, and avoiding interning walks has less impact: around 23%, from 730s on master to 568s with this PR.

2 years agorustdoc: add test case for source sidebar spacing
Michael Howell [Sat, 2 Jul 2022 16:42:49 +0000 (09:42 -0700)]
rustdoc: add test case for source sidebar spacing

2 years agorustdoc: add test case for background color of the sidebar toggle button
Michael Howell [Fri, 1 Jul 2022 22:14:49 +0000 (15:14 -0700)]
rustdoc: add test case for background color of the sidebar toggle button

2 years agorustdoc: add explanatory comment to `width: 100%` line
Michael Howell [Fri, 1 Jul 2022 21:56:56 +0000 (14:56 -0700)]
rustdoc: add explanatory comment to `width: 100%` line

2 years agorustdoc: make source sidebar toggle a real button
Michael Howell [Fri, 1 Jul 2022 18:05:38 +0000 (11:05 -0700)]
rustdoc: make source sidebar toggle a real button

This fixes tab focus, so that you can open and close the sidebar
from keyboard.

2 years agofeat: Add a documentation problem issue template
Gimgim [Sat, 2 Jul 2022 15:09:20 +0000 (20:39 +0530)]
feat: Add a documentation problem issue template

2 years agoAuto merge of #97235 - nbdd0121:unwind, r=Amanieu
bors [Sat, 2 Jul 2022 14:06:27 +0000 (14:06 +0000)]
Auto merge of #97235 - nbdd0121:unwind, r=Amanieu

Fix FFI-unwind unsoundness with mixed panic mode

UB maybe introduced when an FFI exception happens in a `C-unwind` foreign function and it propagates through a crate compiled with `-C panic=unwind` into a crate compiled with `-C panic=abort` (#96926).

To prevent this unsoundness from happening, we will disallow a crate compiled with `-C panic=unwind` to be linked into `panic-abort` *if* it contains a call to `C-unwind` foreign function or function pointer. If no such call exists, then we continue to allow such mixed panic mode linking because it's sound (and stable). In fact we still need the ability to do mixed panic mode linking for std, because we only compile std once with `-C panic=unwind` and link it regardless panic strategy.

For libraries that wish to remain compile-once-and-linkable-to-both-panic-runtimes, a `ffi_unwind_calls` lint is added (gated under `c_unwind` feature gate) to flag any FFI unwind calls that will cause the linkable panic runtime be restricted.

In summary:
```rust
#![warn(ffi_unwind_calls)]

mod foo {
    #[no_mangle]
    pub extern "C-unwind" fn foo() {}
}

extern "C-unwind" {
    fn foo();
}

fn main() {
    // Call to Rust function is fine regardless ABI.
    foo::foo();
    // Call to foreign function, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    unsafe { foo(); }
    //~^ WARNING call to foreign function with FFI-unwind ABI
    let ptr: extern "C-unwind" fn() = foo::foo;
    // Call to function pointer, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    ptr();
    //~^ WARNING call to function pointer with FFI-unwind ABI
}
```

Fix #96926

`@rustbot` label: T-compiler F-c_unwind

2 years agoAuto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obk
bors [Sat, 2 Jul 2022 11:24:17 +0000 (11:24 +0000)]
Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obk

Enable MIR inlining

Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.`

#82280 has shown nice compile time wins could be obtained by enabling MIR inlining.
Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed,
except the interaction with polymorphization which is worked around specifically.

I believe we can proceed with enabling MIR inlining in the near future
(preferably just after beta branching, in case we discover new issues).

Steps before merging:
- [x] figure out the interaction with polymorphization;
- [x] figure out how miri should deal with extern types;
- [x] silence the extra arithmetic overflow warnings;
- [x] remove the codegen fulfilment ICE;
- [x] remove the type normalization ICEs while compiling nalgebra;
- [ ] tweak the inlining threshold.

2 years agoRemove unwanted trailing whitespaces for long declarations
Guillaume Gomez [Sat, 2 Jul 2022 10:43:07 +0000 (12:43 +0200)]
Remove unwanted trailing whitespaces for long declarations

2 years agoAuto merge of #98802 - Dylan-DPC:rollup-u6mwx27, r=Dylan-DPC
bors [Sat, 2 Jul 2022 08:39:20 +0000 (08:39 +0000)]
Auto merge of #98802 - Dylan-DPC:rollup-u6mwx27, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98639 (Factor out `hir::Node::Binding`)
 - #98653 (Add regression test for #79494)
 - #98763 (bootstrap: illumos platform flags for split-debuginfo)
 - #98766 (cleanup mir visitor for `rustc::pass_by_value`)
 - #98783 (interpret: make a comment less scary)

Failed merges:

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

2 years agoAdd #95469 to the release notes
Chris Denton [Sat, 2 Jul 2022 07:51:27 +0000 (08:51 +0100)]
Add #95469 to the release notes

2 years agoFix bug in `rustdoc -Whelp`
Joshua Nelson [Sat, 2 Jul 2022 05:54:05 +0000 (00:54 -0500)]
Fix bug in `rustdoc -Whelp`

Previously, this printed the debugging options, not the lint options,
and only handled `-Whelp`, not `-A/-D/-F`.

This also fixes a few other misc issues:
- Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests
- Add lint headers for tool lints, not just builtin lints
- Remove duplicate run-make test

2 years agoRollup merge of #98783 - RalfJung:jumpscares, r=fee1-dead
Dylan DPC [Sat, 2 Jul 2022 06:53:42 +0000 (12:23 +0530)]
Rollup merge of #98783 - RalfJung:jumpscares, r=fee1-dead

interpret: make a comment less scary

This slipped past my review: "has no meaning" could be read as "is undefined behavior". That is certainly not what we mean so be more clear.

2 years agoRollup merge of #98766 - lcnr:mir-visit-pass_by_value, r=oli-obk
Dylan DPC [Sat, 2 Jul 2022 06:53:41 +0000 (12:23 +0530)]
Rollup merge of #98766 - lcnr:mir-visit-pass_by_value, r=oli-obk

cleanup mir visitor for `rustc::pass_by_value`

by changing `& $($mutability)?` to `$(& $mutability)?`

I also did some formatting changes because I started doing them for the visit methods I changed and then couldn't get myself to stop xx, I hope that's still fairly easy to review.

2 years agoRollup merge of #98763 - citrus-it:illumos-split-debuginfo, r=Mark-Simulacrum
Dylan DPC [Sat, 2 Jul 2022 06:53:40 +0000 (12:23 +0530)]
Rollup merge of #98763 - citrus-it:illumos-split-debuginfo, r=Mark-Simulacrum

bootstrap: illumos platform flags for split-debuginfo

Bootstrap currently provides `-Zunstable-options` for platforms
when using split debuginfo - this commit adds it for the illumos
target too.

2 years agoRollup merge of #98653 - TaKO8Ki:add-regression-test-for-79494, r=Mark-Simulacrum
Dylan DPC [Sat, 2 Jul 2022 06:53:39 +0000 (12:23 +0530)]
Rollup merge of #98653 - TaKO8Ki:add-regression-test-for-79494, r=Mark-Simulacrum

Add regression test for #79494

closes #79494

2 years agoRollup merge of #98639 - camsteffen:no-node-binding, r=compiler-errors
Dylan DPC [Sat, 2 Jul 2022 06:53:38 +0000 (12:23 +0530)]
Rollup merge of #98639 - camsteffen:no-node-binding, r=compiler-errors

Factor out `hir::Node::Binding`

2 years agoAuto merge of #98791 - cuviper:rogue-binary, r=compiler-errors
bors [Sat, 2 Jul 2022 05:56:23 +0000 (05:56 +0000)]
Auto merge of #98791 - cuviper:rogue-binary, r=compiler-errors

Remove the rogue ./suggest-blanket-impl-local-trait

This executable was added in #97488, presumably just a `git add` mistake.

2 years agoLint against executable files in the root directory
Mark Rousskov [Sat, 2 Jul 2022 02:12:29 +0000 (22:12 -0400)]
Lint against executable files in the root directory

This avoids accidental introduction (such as in #97488).

2 years agoRemove the rogue ./suggest-blanket-impl-local-trait
Josh Stone [Sat, 2 Jul 2022 00:22:22 +0000 (17:22 -0700)]
Remove the rogue ./suggest-blanket-impl-local-trait

2 years agoImprove spans for specialization error
Michael Goulet [Fri, 1 Jul 2022 21:41:28 +0000 (14:41 -0700)]
Improve spans for specialization error

2 years agorustdoc: add test cases for :focus on sidebar details elements
Michael Howell [Fri, 1 Jul 2022 23:16:03 +0000 (16:16 -0700)]
rustdoc: add test cases for :focus on sidebar details elements

2 years agoAuto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomez
bors [Fri, 1 Jul 2022 22:55:22 +0000 (22:55 +0000)]
Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #97249 (`<details>`/`<summary>` UI fixes)
 - #98418 (Allow macOS to build LLVM as shared library)
 - #98460 (Use CSS variables to handle theming)
 - #98497 (Improve some inference diagnostics)
 - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests)

Failed merges:

 - #98761 (more `need_type_info` improvements)

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

2 years agorustdoc: add spacing to the source view sidebar
Michael Howell [Fri, 1 Jul 2022 22:29:47 +0000 (15:29 -0700)]
rustdoc: add spacing to the source view sidebar

https://user-images.githubusercontent.com/1593513/176974336-20cecdc3-1885-402a-a6d5-81a8dd03a45d.png

2 years agoAdjust for rustfmt order change
Mark Rousskov [Fri, 1 Jul 2022 22:13:55 +0000 (18:13 -0400)]
Adjust for rustfmt order change

2 years agointerpret: make a comment less scary
Ralf Jung [Fri, 1 Jul 2022 21:57:32 +0000 (17:57 -0400)]
interpret: make a comment less scary

2 years agoRollup merge of #98708 - pinkforest:rustdoc-fix-98690, r=GuillaumeGomez
Guillaume Gomez [Fri, 1 Jul 2022 21:39:10 +0000 (23:39 +0200)]
Rollup merge of #98708 - pinkforest:rustdoc-fix-98690, r=GuillaumeGomez

rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests

Closes #98690 for rustdoc panic

I changed this to do eprintln and orderly panic instead of unwrap doing unhandled panic

~/gg/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc --test -Z unstable-options --persist-doctests /tmp/foobar main.rs
Couldn't create directory for doctest executables: Permission denied (os error 13)

2 years agoRollup merge of #98497 - compiler-errors:span-inference-note, r=lcnr
Guillaume Gomez [Fri, 1 Jul 2022 21:39:09 +0000 (23:39 +0200)]
Rollup merge of #98497 - compiler-errors:span-inference-note, r=lcnr

Improve some inference diagnostics

- Properly point out point location where "type must be known at this point", or else omit the note if it's not associated with a useful span.
- Fix up some type ambiguity diagnostics, errors shouldn't say "cannot infer type for reference `&'a ()`" when the given type has no inference variables.

2 years agoRollup merge of #98460 - GuillaumeGomez:css-simplification, r=jsha
Guillaume Gomez [Fri, 1 Jul 2022 21:39:08 +0000 (23:39 +0200)]
Rollup merge of #98460 - GuillaumeGomez:css-simplification, r=jsha

Use CSS variables to handle theming

This is the start for our simplification of theming. Considering how big the diff quickly becomes, I think it's better to do it in multiple parts.

(The 3 first commits come from https://github.com/rust-lang/rust/pull/98297 so once it's merged, they'll disappear).

Normally they shouldn't be any UI changes. You can check it [here](https://rustdoc.crud.net/imperio/css-simplification/doc/foo/index.html).

cc `@notriddle`
r? `@jsha`

2 years agoRollup merge of #98418 - topjohnwu:macos-dylib, r=jyn514
Guillaume Gomez [Fri, 1 Jul 2022 21:39:07 +0000 (23:39 +0200)]
Rollup merge of #98418 - topjohnwu:macos-dylib, r=jyn514

Allow macOS to build LLVM as shared library

Inspired by how [homebrew](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/llvm.rb) builds and distributes llvm, here we manually create a symlink with a versioned dylib path to make `llvm-config` work properly. Note, the resulting `rustc` executable and `librustc_driver-<hash>.dylib` still links to the un-versioned `libLLVM.dylib` as expected when distributed in the final output. I have confirmed this by checking `otool -L` on both binaries.

After the change, enabling `llvm.link-shared` and `llvm.thin-lto` will be possible on macOS.

2 years agoRollup merge of #97249 - GuillaumeGomez:details-summary-fixes, r=notriddle
Guillaume Gomez [Fri, 1 Jul 2022 21:39:07 +0000 (23:39 +0200)]
Rollup merge of #97249 - GuillaumeGomez:details-summary-fixes, r=notriddle

`<details>`/`<summary>` UI fixes

With images it's easier to understand:

![Screenshot from 2022-05-21 14-10-42](https://user-images.githubusercontent.com/3050060/169653038-9c58de67-589a-4986-a8ff-dbdddaf136a4.png)
![Screenshot from 2022-05-21 14-08-49](https://user-images.githubusercontent.com/3050060/169653042-56e87258-13fe-4f80-9858-4e15c318c3fb.png)

The headings in `<summary>` should not have bottom border so I removed it as well alongside the other fixes.

r? `@jsha`

2 years agoAuto merge of #93967 - cjgillot:short-struct-span, r=petrochenkov
bors [Fri, 1 Jul 2022 20:14:34 +0000 (20:14 +0000)]
Auto merge of #93967 - cjgillot:short-struct-span, r=petrochenkov

Shorten def_span for more items.

The `def_span` query only returns the signature span for functions.
Struct/enum/union definitions can also have a very long body.
This PR shortens the associated span.

2 years agorustdoc cleanup: remove unused function
Michael Howell [Fri, 1 Jul 2022 18:27:09 +0000 (11:27 -0700)]
rustdoc cleanup: remove unused function

2 years agorustdoc: use <details> tag for the source code sidebar
Michael Howell [Fri, 1 Jul 2022 17:33:06 +0000 (10:33 -0700)]
rustdoc: use <details> tag for the source code sidebar

This fixes the extremely poor accessibility of the old system, making it
possible to navigate the sidebar by keyboard, and also implicitly gives the
sidebar items the correct ARIA roles.

2 years agoMove Sized check before first error is created
Michael Goulet [Fri, 1 Jul 2022 01:30:48 +0000 (01:30 +0000)]
Move Sized check before first error is created

2 years agoDon't point at Self type if we can't find an infer variable in ambiguous trait predicate
Michael Goulet [Sat, 25 Jun 2022 17:42:23 +0000 (10:42 -0700)]
Don't point at Self type if we can't find an infer variable in ambiguous trait predicate

2 years agoShow source of ambiguity in a few more places
Michael Goulet [Sat, 25 Jun 2022 16:28:27 +0000 (09:28 -0700)]
Show source of ambiguity in a few more places

2 years agoOnly label place where type is needed if span is meaningful
Michael Goulet [Sat, 25 Jun 2022 16:18:25 +0000 (09:18 -0700)]
Only label place where type is needed if span is meaningful

2 years agoAuto merge of #98767 - Dylan-DPC:rollup-j1gq5sr, r=Dylan-DPC
bors [Fri, 1 Jul 2022 17:33:42 +0000 (17:33 +0000)]
Auto merge of #98767 - Dylan-DPC:rollup-j1gq5sr, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #97488 (Suggest blanket impl to the local traits)
 - #98585 (Make `ThinBox<T>` covariant in `T`)
 - #98644 (fix ICE with -Wrust-2021-incompatible-closure-captures)
 - #98739 (fix grammar in useless doc comment lint)
 - #98741 (Many small deriving cleanups)
 - #98756 (Use const instead of function and make it private)

Failed merges:

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

2 years agoAmend codegen test.
Camille GILLOT [Sun, 29 May 2022 17:44:58 +0000 (19:44 +0200)]
Amend codegen test.

2 years agoBless recursion test.
Camille GILLOT [Wed, 25 May 2022 18:11:07 +0000 (20:11 +0200)]
Bless recursion test.

2 years agoIgnore test with panic=abort.
Camille GILLOT [Tue, 17 May 2022 18:41:58 +0000 (20:41 +0200)]
Ignore test with panic=abort.

2 years agoShorten def_span for more items.
Camille GILLOT [Sun, 13 Feb 2022 15:27:59 +0000 (16:27 +0100)]
Shorten def_span for more items.

2 years agoFactor out hir::Node::Binding
Cameron Steffen [Tue, 28 Jun 2022 18:15:30 +0000 (13:15 -0500)]
Factor out hir::Node::Binding

2 years agoRollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dylan-DPC
Dylan DPC [Fri, 1 Jul 2022 14:49:21 +0000 (20:19 +0530)]
Rollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dylan-DPC

Use const instead of function and make it private

2 years agoRollup merge of #98741 - nnethercote:deriving-cleanups, r=Mark-Simulacrum
Dylan DPC [Fri, 1 Jul 2022 14:49:20 +0000 (20:19 +0530)]
Rollup merge of #98741 - nnethercote:deriving-cleanups, r=Mark-Simulacrum

Many small deriving cleanups

These commits remove lots of little unnecessary things, and clarifies other things.

r? `@Mark-Simulacrum`