Rollup of 7 pull requests - #162827
Rollup of 7 pull requests#162827
Conversation
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
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 differencesShow 934 test diffsStage 1
Stage 2
Additionally, 916 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 28e8a8c81bf3b37909edac6c2a76e56f30cd492f --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (28e8a8c): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
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.
CyclesResults (secondary -1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 496.542s -> 496.137s (-0.08%) |
|
📌 Perf builds for each rolled up PR:
parent commit: 2b9a7be855 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
Successful merges:
r? @ghost
Create a similar rollup