Skip to content

Rollup of 7 pull requests - #162827

Merged
rust-bors[bot] merged 27 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-JmKukFg
Sep 16, 2026
Merged

rust-bors[bot] merged 27 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-JmKukFg

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

bjorn3 and others added 27 commits September 10, 2026 12:33
And only fallback to fcntl(F_SETLK) on Unix when flock() is not supported.
This makes code like this compile:

    #![feature(try_blocks_heterogeneous)]
    macro_rules! make { ($kw:ident) => { try $kw Option<()> {} } }
    fn scope() { make!(bikeshed); }
… drop dead default_method_body_is_const lint
* Windows: cache the stdio write mode for the duration of a lock session

Every write to stdout/stderr re-queried GetStdHandle and GetConsoleMode
(and GetConsoleOutputCP for consoles) to decide how to write, which
dominates bulk writes through a locked handle. Cache the handle and the
console verdict in the sys-level Stdout/Stderr and re-query when a new
lock session begins, so SetStdHandle calls made between lock sessions
keep working.
* Gate the stdio lock-session refresh to Windows

On targets where refresh is a no-op, lock() now compiles to exactly
the code it had before, instead of relying on the borrow-flag dance
optimizing out.
We never set this to anything but the default that I noticed, and now
it's derived from the target triple in LLVM 24.
move bug and span_bug macros to rustc_span

This allows them to be used without depending on rustc_middle.

This is done by using a rustc_interface callback so that, if the callback is set, a internal compiler error diagnostic is printed through that. After that the panic is initiated.

r? @jdonszelmann @bjorn3
…etrochenkov

Use File::*lock*() in rustc_data_structures::flock when possible

And only fallback to `fcntl(F_SETLK)` on Unix when `flock()` is not supported. `flock()` is a lot more sane than `fcntl(F_SETLK)` as it is fd scoped rather than process-scoped and reentrant. `fcntl(F_SETLK)` risks multiple instances of rustc inside the same process acquiring a lock on the same file even when an exclusive lock is requested. Using `File::*lock*()` also allows removing a fair amount of platform specific code for the file locking.

Fixes rust-lang#161361
…chenkov

Parser: Uninterpolate when checking for const closures, try bikeshed blocks & in relevant diagnostic code

On main, various places in the parser manually check for `TokenKind::Ident(…)` while in *most* cases that's not correct / complete as it doesn't account for *interpolated* identifiers (`TokenKind::NtIdent(…)`, "non-terminal" identifiers, i.e., ones that originate from macro metavariables `$ident`).

I've looked at all occurrences of `TokenKind::Ident` & `token::Ident` in the parser to see if each place was intentionally ignoring `NtIdent` or not. I found out that the code pertaining to const closures (unstable feature `const_closures`), to try bikeshed blocks (unstable feature `try_blocks_heterogeneous`) and to some diagnostics & parse error recoveries did not intend to ignore interpolated identifiers. This PR rectifies that.

Note that in most cases, it's not necessary to manually match against `NtIdent` as you can simply utilize helpers like `Token::uninterpolate`, `Token::ident`, `Token::is_keyword`, `Token::is_non_raw_ident` which handle them internally.

I also took the chance to clean up in each vicinity.

<sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
…t-captured-fields, r=estebank

Fix suggestions for names captured by formatting macros

Fixes rust-lang#105520

also improve rust-lang#141136.
but still can not handle rust-lang#96999.

r? @ghost
…ache, r=aapoalas

Windows: cache the stdio write mode for the duration of a lock session

On Windows, every write to stdout/stderr calls `GetStdHandle` and `GetConsoleMode` (and `GetConsoleOutputCP` for consoles) to decide how to write. For bulk writes through a locked handle that is most of the work; rust-lang#154071 measured 14% of CPU time in `is_console` alone.

This caches the handle and the console verdict in the sys-level `Stdout`/`Stderr` and re-queries when a new lock session begins, as [suggested in the issue](rust-lang#154071 (comment)). Holding a `StdoutLock` pins the stream; unlocked writes acquire the lock per call, so they re-query per write exactly as before, and `SetStdHandle` calls made between lock sessions keep working (the rust-lang#40490 behavior is preserved).

Numbers from the issue's workload shape (16 KiB chunks to `NUL`, 4 GiB total, Windows 11):

| mode | before | after |
|---|---|---|
| `stdout().lock()` | 0.478 s (8,561 MiB/s) | 0.120 s (34,350 MiB/s) |
| unlocked | 0.467 s | 0.293 s |

The unlocked case also improves because one implicit lock session can contain several sys-level writes when `LineWriter` splits a chunk at newlines.

The console path cannot run in CI, so it was verified under a pseudoconsole: several writes through one lock session on a CP437 console came through `WriteConsoleW` intact (non-ASCII included), and after `SetConsoleOutputCP` plus a new lock session the refresh picked up the change.

The `refresh` hook is a small `#[cfg(windows)]` shim on `StdoutRaw`/`StderrRaw`; happy to change it to a method on every platform's sys type instead if that is preferred.

Fixes rust-lang#154071
…nBrouwer,petrochenkov

Pre lint port cleanups

Some minor changes split off from rust-lang#162811, to make that a bit easier to review.

cc @JonathanBrouwer
…viper

PassWrapper: adapt for removal of EABIVersion arg in LLVM 24

We never set this to anything but the default that I noticed, and [now](llvm/llvm-project#222672) it's derived from the target triple in LLVM 24.

@rustbot label: +llvm-main
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Sep 15, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Sep 15, 2026
This was referenced Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 2b9a7be (parent) -> 28e8a8c (this PR)

Test differences

Show 934 test diffs

Stage 1

  • [ui] tests/ui/consts/const-closures-interpolated-qualifier.rs: [missing] -> pass (J1)
  • [ui] tests/ui/lint/pre-expansion-parsing.rs: [missing] -> pass (J1)
  • [ui] tests/ui/resolve/suggestions/format-captured-field-issue-105520.rs: [missing] -> pass (J1)
  • [ui] tests/ui/resolve/suggestions/format-captured-non-values.rs: [missing] -> pass (J1)
  • [ui] tests/ui/resolve/suggestions/format-captured-standard-macros.rs#e2015: [missing] -> pass (J1)
  • [ui] tests/ui/resolve/suggestions/format-captured-standard-macros.rs#e2021: [missing] -> pass (J1)
  • [ui (polonius)] tests/ui/consts/const-closures-interpolated-qualifier.rs: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/lint/pre-expansion-parsing.rs: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/resolve/suggestions/format-captured-field-issue-105520.rs: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/resolve/suggestions/format-captured-non-values.rs: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/resolve/suggestions/format-captured-standard-macros.rs#e2015: [missing] -> pass (J2)
  • [ui (polonius)] tests/ui/resolve/suggestions/format-captured-standard-macros.rs#e2021: [missing] -> pass (J2)

Stage 2

  • [ui] tests/ui/consts/const-closures-interpolated-qualifier.rs: [missing] -> pass (J0)
  • [ui] tests/ui/lint/pre-expansion-parsing.rs: [missing] -> pass (J0)
  • [ui] tests/ui/resolve/suggestions/format-captured-field-issue-105520.rs: [missing] -> pass (J0)
  • [ui] tests/ui/resolve/suggestions/format-captured-non-values.rs: [missing] -> pass (J0)
  • [ui] tests/ui/resolve/suggestions/format-captured-standard-macros.rs#e2015: [missing] -> pass (J0)
  • [ui] tests/ui/resolve/suggestions/format-captured-standard-macros.rs#e2021: [missing] -> pass (J0)

Additionally, 916 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 28e8a8c81bf3b37909edac6c2a76e56f30cd492f --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-x86_64-musl: 1h 40m -> 2h 25m (+44.8%)
  2. test-x86_64-gnu-llvm-21: 40m 55s -> 59m 8s (+44.5%)
  3. dist-powerpc64-linux-gnu: 1h 6m -> 1h 35m (+43.3%)
  4. dist-x86_64-solaris: 1h 12m -> 1h 43m (+43.2%)
  5. test-i686-gnu-nopt-2: 2h 25m -> 1h 30m (-38.0%)
  6. test-x86_64-gnu-llvm-22-2: 1h 45m -> 1h 7m (-36.4%)
  7. test-x86_64-gnu-nopt: 2h 30m -> 1h 36m (-35.7%)
  8. test-x86_64-gnu-distcheck: 2h 29m -> 1h 39m (-33.2%)
  9. dist-various-2: 40m 17s -> 50m 48s (+26.1%)
  10. dist-armv7-linux: 1h 15m -> 1h 35m (+26.1%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (28e8a8c): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 3.2%, secondary 3.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.2% [3.2%, 3.2%] 1
Regressions ❌
(secondary)
4.3% [3.4%, 5.3%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) 3.2% [3.2%, 3.2%] 1

Cycles

Results (secondary -1.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.8% [2.1%, 3.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.1% [-8.0%, -4.3%] 2
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 496.542s -> 496.137s (-0.08%)
Artifact size: 406.87 MiB -> 406.79 MiB (-0.02%)

@rust-bors

rust-bors Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#161873 move bug and span_bug macros to rustc_span 99a6fa8bafec55ea9f3d487f2fdb550271fc3233
(link)
#162584 Use File::lock() in rustc_data_structures::flock when pos… 046f9a87f88f3ce4a17cc03ad0cdc6b4a9b61a93
(link)
#162704 Parser: Uninterpolate when checking for const closures, try… eb04a17b3f2bf179d6ac3c4dc9d22d993d62e4a8
(link)
#162787 Fix suggestions for names captured by formatting macros fc6bbb2055b28c9fa3055dbd051613c2e512a9a1
(link)
#159562 Windows: cache the stdio write mode for the duration of a l… 39ba71e797879f80f4bd97e9f206b760ec76e0f2
(link)
#162813 Pre lint port cleanups 610845b676c44f688bef61891813a6cd9934946c
(link)
#162822 PassWrapper: adapt for removal of EABIVersion arg in LLVM 24 2b1a174064f0ccc4eff84204db3d380dccc4aa0e
(link)

parent commit: 2b9a7be855

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants