]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoAuto merge of #102548 - nikic:inline-cell-replace, r=scottmcm
bors [Sun, 2 Oct 2022 09:53:07 +0000 (09:53 +0000)]
Auto merge of #102548 - nikic:inline-cell-replace, r=scottmcm

Mark Cell::replace() as #[inline]

Giving this a try based on https://github.com/rust-lang/rust/issues/102539#issuecomment-1264398807.

21 months agoAuto merge of #102535 - scottmcm:optimize-split-at-partition-point, r=thomcc
bors [Sun, 2 Oct 2022 07:11:15 +0000 (07:11 +0000)]
Auto merge of #102535 - scottmcm:optimize-split-at-partition-point, r=thomcc

Tell LLVM that `partition_point` returns a valid fencepost

This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations.

Demonstration that nightly can't do this optimization today, and leaves in the panicking path: <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=e1074cd2faf5f68e49cffd728ded243a>

r? `@thomcc`

21 months agoAuto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisa
bors [Sun, 2 Oct 2022 04:12:09 +0000 (04:12 +0000)]
Auto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisa

Declare `main` as visibility hidden on targets that default to hidden.

On targets with `default_hidden_visibility` set, which is currrently just WebAssembly, declare the generated `main` function with visibility hidden. This makes it consistent with clang's WebAssembly target, where `main` is just a user function that gets the same visibility as any other user function, which is hidden on WebAssembly unless explicitly overridden.

This will help simplify use cases which in the future may want to automatically wasm-export all visibility-"default" symbols. `main` isn't intended to be wasm-exported, and marking it hidden prevents it from being wasm-exported in that scenario.

21 months agoAuto merge of #102558 - matthiaskrgr:rollup-0odec1c, r=matthiaskrgr
bors [Sun, 2 Oct 2022 01:29:36 +0000 (01:29 +0000)]
Auto merge of #102558 - matthiaskrgr:rollup-0odec1c, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102195 (Improve the COPYRIGHT file)
 - #102313 (Update docs so that deprecated method points to relevant method)
 - #102353 (Allow passing rustix_use_libc cfg using RUSTFLAGS)
 - #102405 (Remove a FIXME whose code got moved away in #62883.)
 - #102525 (rustdoc: remove orphaned link on array bracket)
 - #102557 (fix issue with x.py setup running into explicit panic)

Failed merges:

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

21 months agoRollup merge of #102557 - Joshument:master, r=jyn514
Matthias Krüger [Sun, 2 Oct 2022 01:16:40 +0000 (03:16 +0200)]
Rollup merge of #102557 - Joshument:master, r=jyn514

fix issue with x.py setup running into explicit panic

Fixes problem with [Issue #102555](https://github.com/rust-lang/rust/issues/102555) causing `x.py` setup to fail. Simply requires `rustfmt` be downloaded a little later.

21 months agoRollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jsha
Matthias Krüger [Sun, 2 Oct 2022 01:16:39 +0000 (03:16 +0200)]
Rollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jsha

rustdoc: remove orphaned link on array bracket

This is #98069, but for arrays instead.

For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices.

For generics, the entire thing becomes a link, just like slices.

| Type | Before | After |
|--|--|--|
| u32 | <code>pub fn alpha() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn alpha() -&gt; &amp;'static [<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>; <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">1</a>]</code>
| generic | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a>T<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[T; 1]</a></code>

21 months agoRollup merge of #102405 - hkBst:patch-3, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:39 +0000 (03:16 +0200)]
Rollup merge of #102405 - hkBst:patch-3, r=Mark-Simulacrum

Remove a FIXME whose code got moved away in #62883.

Remove a FIXME whose code got moved away in https://github.com/rust-lang/rust/pull/62883.

21 months agoRollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:38 +0000 (03:16 +0200)]
Rollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-Simulacrum

Allow passing rustix_use_libc cfg using RUSTFLAGS

Before this would error with

```
error: unexpected `rustix_use_libc` as condition name
  |
  = note: `-D unexpected-cfgs` implied by `-D warnings`
  = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
```

I'm setting rustix_use_libc when testing bootstrapping rustc with cg_clif as I'm disabling inline asm here.

21 months agoRollup merge of #102313 - anirudh24seven:update_sleep_ms_doc, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:38 +0000 (03:16 +0200)]
Rollup merge of #102313 - anirudh24seven:update_sleep_ms_doc, r=Mark-Simulacrum

Update docs so that deprecated method points to relevant method

The docs for the deprecated 'park_timeout_ms' method suggests that the user 'use park_timeout' method instead (at https://doc.rust-lang.org/std/thread/index.html).

Making a similar change so that the docs for the deprecated `sleep_ms` method suggest that the user `use sleep` method instead.

21 months agoRollup merge of #102195 - wesleywiser:copyright2, r=Mark-Simulacrum,joshtriplett
Matthias Krüger [Sun, 2 Oct 2022 01:16:37 +0000 (03:16 +0200)]
Rollup merge of #102195 - wesleywiser:copyright2, r=Mark-Simulacrum,joshtriplett

Improve the COPYRIGHT file

This is a cutdown version of #96784 which doesn't include the apfloat changes. At this point, the other 3 commits in this PR don't seem to be controversial and I'd like to go ahead and get those merged which will leave #96784 with only the more complex apfloat related change.

r? `@Mark-Simulacrum` since you are the reviewer on that PR

cc `@joshtriplett` since you also had feedback in that PR

21 months agofix issue with x.py setup running into explicit panic
Joshument [Sat, 1 Oct 2022 22:51:10 +0000 (18:51 -0400)]
fix issue with x.py setup running into explicit panic

21 months agoAuto merge of #102193 - ferrocene:pa-remote-test-server-improvements, r=Mark-Simulacrum
bors [Sat, 1 Oct 2022 22:39:59 +0000 (22:39 +0000)]
Auto merge of #102193 - ferrocene:pa-remote-test-server-improvements, r=Mark-Simulacrum

Change argument handling in `remote-test-server` and add new flags

This PR updates `remote-test-server` to add two new flags:

* `--sequential` disables parallel test execution, accepting one connection at the time instead. We need this for Ferrocene as one of our emulators occasionally deadlocks when running multiple tests in parallel.
* `--bind <ip:port>` allows customizing the IP and port `remote-test-server` binds to, rather than using the default value.

While I was changing the flags, and [after chatting on what to do on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/remote-test-server.20flags),  I took this opportunity to cleanup argument handling in `remote-test-server`, which is a breaking change:

* The `verbose` argument has been renamed to the `--verbose` flag.
* The `remote` argument has been removed in favor of the `--bind 0.0.0.0:12345` flag. The only thing the argument did was to change the bound IP to 0.0.0.0, which can easily be replicated with `--bind` and also is not secure as our "remote" default.

I'm also open to keep the old arguments with deprecation warnings.

r? `@Mark-Simulacrum`

21 months agoAuto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obk
bors [Sat, 1 Oct 2022 19:54:55 +0000 (19:54 +0000)]
Auto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obk

Compute lint levels by definition

Second attempt to https://github.com/rust-lang/rust/pull/101620.

I think that I have removed the perf regression.

21 months agoAuto merge of #102545 - matthiaskrgr:rollup-13i3tc3, r=matthiaskrgr
bors [Sat, 1 Oct 2022 17:11:19 +0000 (17:11 +0000)]
Auto merge of #102545 - matthiaskrgr:rollup-13i3tc3, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #101675 (Improve `File::set_times` error handling)
 - #102500 (Remove `expr_parentheses_needed` from `ParseSess`)
 - #102533 (rustdoc: remove unused CSS selector `a.source`)

Failed merges:

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

21 months agoMark Cell::replace() as #[inline]
Nikita Popov [Sat, 1 Oct 2022 15:30:54 +0000 (17:30 +0200)]
Mark Cell::replace() as #[inline]

21 months agoRollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPC
Matthias Krüger [Sat, 1 Oct 2022 14:45:05 +0000 (16:45 +0200)]
Rollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPC

rustdoc: remove unused CSS selector `a.source`

The link with this class attribute was removed in https://github.com/rust-lang/rust/commit/4d16de01d0beb84dc4a351022ea5cb587b4ab557#diff-3fe025bd3bd6b48044d0bd8d8c3122de5ecdb1dcd72a9dbe3c24430883595012L1281-R1324

21 months agoRollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot
Matthias Krüger [Sat, 1 Oct 2022 14:45:05 +0000 (16:45 +0200)]
Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot

Remove `expr_parentheses_needed` from `ParseSess`

Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.

21 months agoRollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett
Matthias Krüger [Sat, 1 Oct 2022 14:45:04 +0000 (16:45 +0200)]
Rollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett

Improve `File::set_times` error handling

Makes `File::set_times` return an error if the `SystemTime` cannot fit into the required type instead of panicking in `FileTimes::set_{accessed,modified}`. Also makes `File::set_times` return an error on Windows if either of the passed times are `0xFFFF_FFFF_FFFF_FFFF`, as [the documentation for `SetFileTime`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfiletime) states that this will prevent operations on the file handle from updating the corresponding file time instead of setting the corresponding file time to that value.

Tracking issue: #98245

21 months agoAdd sanity Drop impl.
Camille GILLOT [Sat, 1 Oct 2022 07:49:52 +0000 (09:49 +0200)]
Add sanity Drop impl.

21 months agoAdd FIXME.
Camille GILLOT [Sat, 1 Oct 2022 07:46:39 +0000 (09:46 +0200)]
Add FIXME.

21 months agoUse a SortedMap instead of a VecMap.
Camille GILLOT [Fri, 30 Sep 2022 17:48:55 +0000 (19:48 +0200)]
Use a SortedMap instead of a VecMap.

21 months agoReplace retain with assertion.
Camille GILLOT [Fri, 30 Sep 2022 17:15:57 +0000 (19:15 +0200)]
Replace retain with assertion.

21 months agoAdd fast path without visiting.
Camille GILLOT [Fri, 30 Sep 2022 06:22:50 +0000 (08:22 +0200)]
Add fast path without visiting.

21 months agoSimplify LintLevelsProvider.
Camille GILLOT [Thu, 29 Sep 2022 20:03:54 +0000 (22:03 +0200)]
Simplify LintLevelsProvider.

21 months agoCompute by owner instead of HirId.
Camille GILLOT [Thu, 29 Sep 2022 19:07:06 +0000 (21:07 +0200)]
Compute by owner instead of HirId.

21 months agoDo not fetch HIR node when iterating to find lint.
Camille GILLOT [Thu, 15 Sep 2022 16:39:53 +0000 (18:39 +0200)]
Do not fetch HIR node when iterating to find lint.

21 months agoCorrect Key impl for HirId.
Camille GILLOT [Sat, 10 Sep 2022 09:55:10 +0000 (11:55 +0200)]
Correct Key impl for HirId.

21 months agoAdd FIXME.
Camille GILLOT [Sat, 10 Sep 2022 08:16:27 +0000 (10:16 +0200)]
Add FIXME.

21 months agoComment LintLevelSets.
Camille GILLOT [Sat, 10 Sep 2022 08:14:51 +0000 (10:14 +0200)]
Comment LintLevelSets.

21 months agoMove lint level computation to rustc_middle::lint.
Camille GILLOT [Sat, 24 Sep 2022 14:11:18 +0000 (16:11 +0200)]
Move lint level computation to rustc_middle::lint.

21 months agoReduce visibilities and remove dead code.
Camille GILLOT [Sat, 1 Oct 2022 07:44:21 +0000 (09:44 +0200)]
Reduce visibilities and remove dead code.

21 months agoMove code to rustc_lint.
Camille GILLOT [Sat, 1 Oct 2022 07:41:32 +0000 (09:41 +0200)]
Move code to rustc_lint.

21 months agoAuto merge of #102519 - Alexendoo:format-args-macro-str, r=m-ou-se
bors [Sat, 1 Oct 2022 14:15:29 +0000 (14:15 +0000)]
Auto merge of #102519 - Alexendoo:format-args-macro-str, r=m-ou-se

Fix `format_args` capture for macro expanded format strings

Since #100996 `format_args` capture for macro expanded strings aren't prevented when the span of the expansion points to a string literal, e.g.

```rust
// not a terribly realistic example, but also happens for proc_macros that set
// the span of the output to an input str literal, such as indoc
macro_rules! x {
    ($e:expr) => { $e }
}

fn main() {
    let a = 1;
    println!(x!("{a}"));
}
```

The tests didn't catch it as the span of `concat!()` points to the macro invocation

r? `@m-ou-se`

21 months agoRemove unused tool_name.
Camille GILLOT [Sat, 10 Sep 2022 07:58:35 +0000 (09:58 +0200)]
Remove unused tool_name.

21 months agoCompute `lint_levels` by definition
Deadbeef [Fri, 22 Jul 2022 16:48:36 +0000 (16:48 +0000)]
Compute `lint_levels` by definition

21 months agoAllow query system to recover a HirId.
Camille GILLOT [Fri, 9 Sep 2022 10:05:01 +0000 (12:05 +0200)]
Allow query system to recover a HirId.

21 months agoAuto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank
bors [Sat, 1 Oct 2022 10:44:25 +0000 (10:44 +0000)]
Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank

Move lint level source explanation to the bottom

So, uhhhhh

r? `@estebank`

## User-facing change

"note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic:
```diff
-   = note: `#[warn(unsupported_calling_conventions)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
+   = note: `#[warn(unsupported_calling_conventions)]` on by default
```

Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO.

## Developer-facing change

`struct_span_lint` and similar methods have a different signature.

Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)`
After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>`

The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion.

Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere.

## Subtle problem

By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings...

I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate.

## P.S.

I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢

21 months agoRemove `LintDiagnosticBuilder`
Maybe Waffle [Sun, 18 Sep 2022 17:19:13 +0000 (21:19 +0400)]
Remove `LintDiagnosticBuilder`

21 months ago`ui-fulldeps`: adopt to the new rustc lint API
Maybe Waffle [Thu, 22 Sep 2022 14:25:05 +0000 (18:25 +0400)]
`ui-fulldeps`: adopt to the new rustc lint API

21 months agobless rustdoc-ui
Maybe Waffle [Fri, 23 Sep 2022 18:34:34 +0000 (22:34 +0400)]
bless rustdoc-ui

21 months agobless a miri test
Maybe Waffle [Fri, 23 Sep 2022 09:41:15 +0000 (13:41 +0400)]
bless a miri test

21 months agobless clippy
Maybe Waffle [Thu, 22 Sep 2022 16:04:22 +0000 (20:04 +0400)]
bless clippy

21 months agobless ui tests
Maybe Waffle [Sun, 18 Sep 2022 15:55:36 +0000 (19:55 +0400)]
bless ui tests

21 months agoMove lint level source explanation to the bottom
Maybe Waffle [Sun, 18 Sep 2022 15:47:21 +0000 (19:47 +0400)]
Move lint level source explanation to the bottom

21 months agorustdoc: adopt to the new lint API
Maybe Waffle [Fri, 16 Sep 2022 15:07:20 +0000 (19:07 +0400)]
rustdoc: adopt to the new lint API

21 months agoclippy: adopt to the new lint API
Maybe Waffle [Fri, 16 Sep 2022 15:07:01 +0000 (19:07 +0400)]
clippy: adopt to the new lint API

21 months agoRefactor rustc lint API
Maybe Waffle [Fri, 16 Sep 2022 07:01:02 +0000 (11:01 +0400)]
Refactor rustc lint API

21 months agoAuto merge of #102237 - GuillaumeGomez:sidebar-links-color, r=notriddle
bors [Sat, 1 Oct 2022 08:14:25 +0000 (08:14 +0000)]
Auto merge of #102237 - GuillaumeGomez:sidebar-links-color, r=notriddle

Migrate sidebar links color to CSS variables and unify themes with ayu

Part of https://github.com/rust-lang/rust/pull/98460.

This PR does two things:
 1. Migrate more theme CSS rules toward CSS variables.
 2. Remove `a.current` specific colors depending on the kind of the item behind the link. The `ayu` theme was already doing it this way and I think it makes much more sense like this.

You can test it [here](https://rustdoc.crud.net/imperio/sidebar-links-color/lib2/struct.Foo.html) by hovering other module's items in the sidebar (or check the selector `a.current`).

cc `@jsha`
r? `@notriddle`

21 months agoTell LLVM that `partition_point` returns a valid fencepost
Scott McMurray [Sat, 1 Oct 2022 06:39:15 +0000 (23:39 -0700)]
Tell LLVM that `partition_point` returns a valid fencepost

This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations.

21 months agorustdoc: remove unused CSS selector `a.source`
Michael Howell [Sat, 1 Oct 2022 05:17:04 +0000 (22:17 -0700)]
rustdoc: remove unused CSS selector `a.source`

The link with this class attribute was removed in
4d16de01d0beb84dc4a351022ea5cb587b4ab557.

21 months agoAuto merge of #102526 - matthiaskrgr:rollup-9o6p98c, r=matthiaskrgr
bors [Sat, 1 Oct 2022 03:56:21 +0000 (03:56 +0000)]
Auto merge of #102526 - matthiaskrgr:rollup-9o6p98c, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #102361 (Fix ICE in const_trait check code)
 - #102373 (Flush delayed bugs before codegen)
 - #102483 (create def ids for impl traits during ast lowering)
 - #102490 (Generate synthetic region from `impl` even in closure body within an associated fn)
 - #102492 (Don't lower assoc bindings just to deny them)
 - #102493 (Group together more size assertions.)
 - #102521 (rustdoc: add missing margin to no-docblock methods)

Failed merges:

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

21 months ago`SetFileTime` doesn't allow setting the file time to `0xFFFF_FFFF_FFFF_FFFF`
beetrees [Sat, 10 Sep 2022 10:33:23 +0000 (11:33 +0100)]
`SetFileTime` doesn't allow setting the file time to `0xFFFF_FFFF_FFFF_FFFF`

21 months agoError instead of panicking when setting file times if the passed `SystemTime` doesn...
beetrees [Sat, 10 Sep 2022 10:29:01 +0000 (11:29 +0100)]
Error instead of panicking when setting file times if the passed `SystemTime` doesn't fit into the required type

21 months agoAuto merge of #101969 - reez12g:issue-101306, r=reez12g
bors [Sat, 1 Oct 2022 01:03:35 +0000 (01:03 +0000)]
Auto merge of #101969 - reez12g:issue-101306, r=reez12g

Make fmt downloaded on every invocation of bootstrap

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

21 months agoAdd a comment to downloading fmt statement
Rento Ezoe [Fri, 30 Sep 2022 23:06:24 +0000 (08:06 +0900)]
Add a comment to downloading fmt statement

Co-authored-by: Joshua Nelson <github@jyn.dev>
21 months agoAllow `hidden` in src/test/codegen/abi-main-signature-32bit-c-int.rs
Dan Gohman [Fri, 30 Sep 2022 21:55:26 +0000 (14:55 -0700)]
Allow `hidden` in src/test/codegen/abi-main-signature-32bit-c-int.rs

21 months agoRollup merge of #102521 - notriddle:notriddle/impl-items-section, r=GuillaumeGomez
Matthias Krüger [Fri, 30 Sep 2022 21:38:27 +0000 (23:38 +0200)]
Rollup merge of #102521 - notriddle:notriddle/impl-items-section, r=GuillaumeGomez

rustdoc: add missing margin to no-docblock methods

Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks).

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations

<details>

# Before

![image](https://user-images.githubusercontent.com/1593513/193318777-2bc082fb-6579-4bd8-a0e3-d23a32b4820f.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193318968-b6ccacad-940b-4ed3-a0ae-dcf2079c2bae.png)

</details>

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html

<details>

# Before

![image](https://user-images.githubusercontent.com/1593513/193319636-7ff9c99e-0208-462c-99de-7672e92ce4d6.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193322675-403bd165-7394-43e2-8ab4-d1f364666093.png)

</details>

21 months agoRollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqd
Matthias Krüger [Fri, 30 Sep 2022 21:38:27 +0000 (23:38 +0200)]
Rollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqd

Group together more size assertions.

Also add a few more assertions for some relevant token-related types.

And fix an erroneous comment in `rustc_errors`.

r? `@lqd`

21 months agoRollup merge of #102492 - compiler-errors:simplify-deny-assoc-bindings, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:26 +0000 (23:38 +0200)]
Rollup merge of #102492 - compiler-errors:simplify-deny-assoc-bindings, r=cjgillot

Don't lower assoc bindings just to deny them

Some clean-up: https://github.com/rust-lang/rust/pull/102338#discussion_r981590931

21 months agoRollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:26 +0000 (23:38 +0200)]
Rollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillot

Generate synthetic region from `impl` even in closure body within an associated fn

Fixes #102209

21 months agoRollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:25 +0000 (23:38 +0200)]
Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillot

create def ids for impl traits during ast lowering

r? `@cjgillot`

21 months agoRollup merge of #102373 - Nilstrieb:cannot-get-layout-of-branch-error, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:25 +0000 (23:38 +0200)]
Rollup merge of #102373 - Nilstrieb:cannot-get-layout-of-branch-error, r=cjgillot

Flush delayed bugs before codegen

Sometimes it can happen that invalid code like a TyKind::Error makes its way through the compiler without triggering any errors (this is always a bug in rustc but bugs do happen sometimes :)). These ICEs will manifest in the backend like as cg_llvm not being able to get the layout of `[type error]`, which makes it hard to debug. By flushing before codegen, we display all the delayed bugs, making it easier to trace it to the root of the problem.

I tried this on #102366 and it showed tons of of delayed bugs and no error in cg_llvm, so it seems to be working.

21 months agoRollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholk
Matthias Krüger [Fri, 30 Sep 2022 21:38:24 +0000 (23:38 +0200)]
Rollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholk

Fix ICE in const_trait check code

This fixes #102156.

21 months agorustdoc: remove orphaned link on array bracket
Michael Howell [Fri, 30 Sep 2022 21:19:19 +0000 (14:19 -0700)]
rustdoc: remove orphaned link on array bracket

This is 682889fb06591c4245422b73b005c5d8ae2d0cad, but for arrays instead.

For non-generics, this retains links to the array page, but instead of
trying to link it all, it only links the length part, which distinguishes
arrays from slices.

For generics, the entire thing becomes a link, just like slices.

21 months agoGroup together more size assertions.
Nicholas Nethercote [Thu, 29 Sep 2022 23:23:55 +0000 (09:23 +1000)]
Group together more size assertions.

Also add a few more assertions for some relevant token-related types.

And fix an erroneous comment in `rustc_errors`.

21 months agoAuto merge of #102517 - nikic:update-llvm-8, r=cuviper
bors [Fri, 30 Sep 2022 20:41:26 +0000 (20:41 +0000)]
Auto merge of #102517 - nikic:update-llvm-8, r=cuviper

Update LLVM submodule

This merges in the current upstream release/15.x branch.

Fixes #102402.

21 months agoFix typo
nils [Fri, 30 Sep 2022 19:02:53 +0000 (21:02 +0200)]
Fix typo

21 months agorustdoc: update test cases for `<section>` tags in traits
Michael Howell [Fri, 30 Sep 2022 18:17:03 +0000 (11:17 -0700)]
rustdoc: update test cases for `<section>` tags in traits

21 months agocreate def ids for impl traits during ast lowering
Santiago Pastorino [Fri, 30 Sep 2022 13:45:02 +0000 (10:45 -0300)]
create def ids for impl traits during ast lowering

21 months agoUpdate compiler/rustc_interface/src/queries.rs
Camille Gillot [Fri, 30 Sep 2022 17:50:48 +0000 (19:50 +0200)]
Update compiler/rustc_interface/src/queries.rs

21 months agoAuto merge of #102520 - matthiaskrgr:rollup-7nreat0, r=matthiaskrgr
bors [Fri, 30 Sep 2022 17:47:57 +0000 (17:47 +0000)]
Auto merge of #102520 - matthiaskrgr:rollup-7nreat0, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102276 (Added more const_closure functionality)
 - #102382 (Manually order `DefId` on 64-bit big-endian)
 - #102421 (remove the unused :: between trait and type to give user correct diag…)
 - #102495 (Reinstate `hir-stats.rs` test for stage 1.)
 - #102505 (rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`)
 - #102506 (Specify `DynKind::Dyn`)

Failed merges:

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

21 months agorustdoc: add gui test for no-docblock margins
Michael Howell [Fri, 30 Sep 2022 17:44:15 +0000 (10:44 -0700)]
rustdoc: add gui test for no-docblock margins

21 months agorustdoc: add missing margin to no-docblock trait items
Michael Howell [Fri, 30 Sep 2022 17:15:59 +0000 (10:15 -0700)]
rustdoc: add missing margin to no-docblock trait items

Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee,
this time fixing the appearance of methods that have no docblock (we didn't
notice this one because libstd docs *always* have docblocks).

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html

21 months agoRollup merge of #102506 - TaKO8Ki:specify-dyn-kind, r=lcnr
Matthias Krüger [Fri, 30 Sep 2022 17:06:07 +0000 (19:06 +0200)]
Rollup merge of #102506 - TaKO8Ki:specify-dyn-kind, r=lcnr

Specify `DynKind::Dyn`

ref: https://github.com/rust-lang/rust/pull/101212#discussion_r958861297

21 months agoRollup merge of #102505 - notriddle:sub-variant-h4, r=GuillaumeGomez
Matthias Krüger [Fri, 30 Sep 2022 17:06:06 +0000 (19:06 +0200)]
Rollup merge of #102505 - notriddle:sub-variant-h4, r=GuillaumeGomez

rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`

This rule, added in 69df43b041f76251391f11264c1ff763ca2a64a0 to override the default `h4` style, has been obsoleted when a65c98fefb78cddee955b87214732b0de30a769f changed it so that only the top docblock put `border-bottom` on `h4.`

21 months agoRollup merge of #102495 - nnethercote:reinstate-hir-stats, r=lqd
Matthias Krüger [Fri, 30 Sep 2022 17:06:06 +0000 (19:06 +0200)]
Rollup merge of #102495 - nnethercote:reinstate-hir-stats, r=lqd

Reinstate `hir-stats.rs` test for stage 1.

It was disabled in #94075 for stage 1 because that PR changed type layouts such that the results for this test were different for stage 1 and stage 2. But now that #94075 is in beta, the results for this test are now the same for stage 1 and stage 2.

r? ```@lqd```

21 months agoRollup merge of #102421 - lyming2007:issue-101866, r=lcnr
Matthias Krüger [Fri, 30 Sep 2022 17:06:05 +0000 (19:06 +0200)]
Rollup merge of #102421 - lyming2007:issue-101866, r=lcnr

remove the unused :: between trait and type to give user correct diag…

…nostic information

modified:   compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
new file:   src/test/ui/type/issue-101866.rs
new file:   src/test/ui/type/issue-101866.stderr

21 months agoRollup merge of #102382 - cuviper:defid-order, r=fee1-dead
Matthias Krüger [Fri, 30 Sep 2022 17:06:05 +0000 (19:06 +0200)]
Rollup merge of #102382 - cuviper:defid-order, r=fee1-dead

Manually order `DefId` on 64-bit big-endian

`DefId` uses different field orders on 64-bit big-endian vs. others, in
order to optimize its `Hash` implementation. However, that also made it
derive different lexical ordering for `PartialOrd` and `Ord`. That
caused spurious differences wherever `DefId`s are sorted, like the
candidate sources list in `report_method_error`.

Now we manually implement `PartialOrd` and `Ord` on 64-bit big-endian to
match the same lexical ordering as other targets, fixing at least one
test, `src/test/ui/methods/method-ambig-two-traits-cross-crate.rs`.

21 months agoRollup merge of #102276 - ink-feather-org:const_closure_ext, r=fee1-dead
Matthias Krüger [Fri, 30 Sep 2022 17:06:04 +0000 (19:06 +0200)]
Rollup merge of #102276 - ink-feather-org:const_closure_ext, r=fee1-dead

Added more const_closure functionality

Enables ConstFnMutClosure to use a tuple of mutable references instead of just a mutable reference to a tuple.

Removes the new function, since it would barely be usable with this new code.

r? `@fee1-dead`

21 months agorustdoc: add missing margin to no-docblock methods
Michael Howell [Fri, 30 Sep 2022 16:42:07 +0000 (09:42 -0700)]
rustdoc: add missing margin to no-docblock methods

Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee,
this time fixing the appearance of methods that have no docblock (we didn't
notice this one because libstd docs *always* have docblocks).

See how it looks without the fix at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations

21 months agoFix format_args capture for macro expanded format strings
Alex Macleod [Fri, 30 Sep 2022 15:44:39 +0000 (16:44 +0100)]
Fix format_args capture for macro expanded format strings

21 months agoAdd back ConstFnMutClosure::new, fix formatting
onestacked [Fri, 30 Sep 2022 15:41:01 +0000 (17:41 +0200)]
Add back ConstFnMutClosure::new, fix formatting

21 months agoFixed Documentation for wrap_mut_2_imp
onestacked [Fri, 30 Sep 2022 15:16:59 +0000 (17:16 +0200)]
Fixed Documentation for wrap_mut_2_imp

21 months agoAdded more const_closure functionality.
onestacked [Fri, 30 Sep 2022 15:16:59 +0000 (17:16 +0200)]
Added more const_closure functionality.

21 months agoUpdate LLVM submodule
Nikita Popov [Fri, 30 Sep 2022 14:39:32 +0000 (16:39 +0200)]
Update LLVM submodule

Fixes #102402.

21 months agoAuto merge of #102484 - beetrees:duration-debug-bug-fix, r=scottmcm
bors [Fri, 30 Sep 2022 14:16:57 +0000 (14:16 +0000)]
Auto merge of #102484 - beetrees:duration-debug-bug-fix, r=scottmcm

Fix integer overflow in `format!("{:.0?}", Duration::MAX)`

Currently `format!("{:.0?}", Duration::MAX)` causes an integer overflow in the `Duration` `Debug` impl ([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=67675c6895bdb2e37ee727f0ed7622b2)). This is because the carry from the rounding of the fractional_part into the integer_part will cause the integer_part to overflow as it is already `u64::MAX`. This PR uses a larger integer type to avoid that issue, and adds a test for the correct behaviour.

21 months agoAdd comment explaining why we flush delayed bugs before codegen
nils [Fri, 30 Sep 2022 12:11:18 +0000 (14:11 +0200)]
Add comment explaining why we flush delayed bugs before codegen

21 months agoAdd GUI test for sidebar links color
Guillaume Gomez [Sat, 24 Sep 2022 14:31:34 +0000 (16:31 +0200)]
Add GUI test for sidebar links color

21 months ago* Migrate sidebar links color to new CSS theme handling
Guillaume Gomez [Sat, 24 Sep 2022 13:49:10 +0000 (15:49 +0200)]
* Migrate sidebar links color to new CSS theme handling
* Remove specific color handling for ".current" items in the sidebar.

21 months agoAuto merge of #102509 - matthiaskrgr:rollup-gtenet8, r=matthiaskrgr
bors [Fri, 30 Sep 2022 10:39:09 +0000 (10:39 +0000)]
Auto merge of #102509 - matthiaskrgr:rollup-gtenet8, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #101075 (Migrate rustc_codegen_gcc to SessionDiagnostics )
 - #102350 (Improve errors for incomplete functions in struct definitions)
 - #102481 (rustdoc: remove unneeded CSS `.rust-example-rendered { position }`)
 - #102491 (rustdoc: remove no-op source sidebar `opacity`)
 - #102499 (Adjust the s390x data layout for LLVM 16)

Failed merges:

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

21 months agoRollup merge of #102499 - cuviper:llvm-16-s390x, r=nikic
Matthias Krüger [Fri, 30 Sep 2022 08:22:39 +0000 (10:22 +0200)]
Rollup merge of #102499 - cuviper:llvm-16-s390x, r=nikic

Adjust the s390x data layout for LLVM 16

LLVM [D131158] changed the SystemZ data layout to always set 64-bit
vector alignment, which used to be conditional on the "vector" feature.

[D131158]: https://reviews.llvm.org/D131158

r? `@nikic`

21 months agoRollup merge of #102491 - notriddle:notriddle/sidebar-opacity, r=GuillaumeGomez
Matthias Krüger [Fri, 30 Sep 2022 08:22:38 +0000 (10:22 +0200)]
Rollup merge of #102491 - notriddle:notriddle/sidebar-opacity, r=GuillaumeGomez

rustdoc: remove no-op source sidebar `opacity`

These rules were added in dc2c9723343c985740be09919236a6e96c4e4433 to work with CSS transitions. They're otherwise redundant, since the `visibility` property already hides everything.

https://github.com/rust-lang/rust/blob/dc2c9723343c985740be09919236a6e96c4e4433/src/librustdoc/html/static/css/rustdoc.css#L350-L354

The transition was remove with 237d62588ddb4b7a93f3f5c61ea9253eba30ed5d, but the now-redundant `opacity` property was not.

21 months agoRollup merge of #102481 - notriddle:notriddle/rust-example-rendered, r=GuillaumeGomez
Matthias Krüger [Fri, 30 Sep 2022 08:22:38 +0000 (10:22 +0200)]
Rollup merge of #102481 - notriddle:notriddle/rust-example-rendered, r=GuillaumeGomez

rustdoc: remove unneeded CSS `.rust-example-rendered { position }`

The Run button isn't inside the `<pre>` any more. It's instead nested below the example wrapper.

The class name can't be removed from the DOM, because `main.js` uses it.

21 months agoRollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, r=fee1-dead
Matthias Krüger [Fri, 30 Sep 2022 08:22:37 +0000 (10:22 +0200)]
Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, r=fee1-dead

Improve errors for incomplete functions in struct definitions

Given the following code:

```rust
fn main() {}

struct Foo {
    fn
}
```

[playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345)

The current output is:

```
   Compiling playground v0.0.1 (/playground)
error: functions are not allowed in struct definitions
 --> src/main.rs:4:5
  |
4 |     fn
  |     ^^
  |
  = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks
  = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information

error: could not compile `playground` due to previous error
```

In this case, rustc should suggest escaping `fn` to use it as an identifier.

21 months agoRollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwco
Matthias Krüger [Fri, 30 Sep 2022 08:22:36 +0000 (10:22 +0200)]
Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwco

Migrate rustc_codegen_gcc to SessionDiagnostics

As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate.

``@rustbot`` label +A-translation

21 months agoAuto merge of #102387 - nnethercote:inline-Token-PartialEq, r=lqd
bors [Fri, 30 Sep 2022 07:57:12 +0000 (07:57 +0000)]
Auto merge of #102387 - nnethercote:inline-Token-PartialEq, r=lqd

Inline a few functions.

r? `@ghost`

21 months agorustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`
Michael Howell [Fri, 30 Sep 2022 06:57:01 +0000 (23:57 -0700)]
rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`

This rule, added in 69df43b041f76251391f11264c1ff763ca2a64a0 to override the
default `h4` style, has been obsoleted when
a65c98fefb78cddee955b87214732b0de30a769f changed it so that only the top
docblock put `border-bottom` on `h4.`

21 months agospecify `DynKind::Dyn`
Takayuki Maeda [Fri, 30 Sep 2022 06:52:20 +0000 (15:52 +0900)]
specify `DynKind::Dyn`

21 months agoAuto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Ki
bors [Fri, 30 Sep 2022 04:24:14 +0000 (04:24 +0000)]
Auto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Ki

Serialize return-position `impl Trait` in trait hidden values in foreign libraries

Fixes #101630

21 months agoRemove expr_parentheses_needed from ParseSess
Michael Goulet [Fri, 30 Sep 2022 01:38:15 +0000 (01:38 +0000)]
Remove expr_parentheses_needed from ParseSess