Skip to content

Rollup of 23 pull requests#154226

Closed
JonathanBrouwer wants to merge 55 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-tqHNSWf
Closed

Rollup of 23 pull requests#154226
JonathanBrouwer wants to merge 55 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-tqHNSWf

Conversation

@JonathanBrouwer
Copy link
Contributor

Successful merges:

r? @ghost

Create a similar rollup

petrochenkov and others added 30 commits February 12, 2026 18:20
In CI, the receiver thread can be descheduled for a surprisingly long time, so
there's no guarantee that a timeout actually occurs.
Instead of relying on the linker to find the 'environ' symbol, use
dlsym.

Fixes rust-lang#153451
Sponsored by:	ConnectWise
Currently, building std for a custom Wasm target with an OS other than `unknown` will fail, because `sys/alloc/mod.rs` will attempt to use `sys/alloc/wasm.rs`, the dlmalloc-based allocator used on `wasm32-unknown-unknown`.  However, currently dlmalloc is only pulled in when `target_os = "unknown"`.

Instead, we should make `Cargo.toml` and `alloc/mod.rs` match: either
- disable `wasm.rs` in `alloc/mod.rs` where `not(target_os = "unknown")`, or
- pull in `dlmalloc` for all Wasm targets with  `target_family = "wasm32"` that aren't covered by the [upper branches of `alloc/mod.rs`](https://github.com/rust-lang/rust/blob/main/library/std/src/sys/alloc/mod.rs#L72-L100).

This PR takes the latter approach, because it allows more code to compile without a custom allocator.
Add a HasAttrs<'tcx, Tcx> trait to rustc_hir that allows find_attr! to
accept DefId, LocalDefId, OwnerId, and HirId directly, instead of
requiring callers to manually fetch the attribute slice first.

The trait is defined in rustc_hir with a generic Tcx parameter to avoid
a dependency cycle (rustc_hir cannot depend on rustc_middle). The four
concrete impls for TyCtxt are in rustc_middle.
This improves startup performance by 16%, shown by an optimized
hello-world program. glibc's `pthread_getattr_np` performs expensive
syscalls when reading `/proc/self/maps`. That is all wasted with
`panic = immediate-abort` active because `init()` immediately discards
the return value from `install_main_guard()`. A similar improvement can
be seen in environments that don't have `/proc`. This change is safe
because the immediately succeeding comment says that we rely on Linux's
"own stack-guard mechanism".
Avoid an ICE for:

    struct A;
    impl A<B> {}

The compiler no longer panics and can proceed to emit existing diagnostics.

Adds `tests/ui/missing/undeclared-generic-parameter.rs`.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Now that the tracking issue has been opened, point to it.
- `char::is_cased`
- `char::is_titlecase`
- `char::case`
- `char::to_titlecase`
When a function's documentation has to explain the meaning of nested results
and options, then it is often a good candidate for using a custom result enum
instead.

This commit also renames `DepNodeColorMap::try_mark` to `try_set_color`, to
make it more distinct from the similarly-named `DepGraph::try_mark_green`.

The difference is that `try_mark_green` is a higher-level operation that tries
to determine whether a node _can_ be marked green, whereas `try_set_color` is a
lower-level operation that actually records a color for the node.
This method is only used to initialize the always-red node, which can be done
with `try_set_color` instead.
…dPthreadGetattrNp, r=Mark-Simulacrum

Skip stack_start_aligned for immediate-abort

This improves startup performance by 16%, shown by an optimized hello-world program. glibc's `pthread_getattr_np` performs expensive syscalls when reading `/proc/self/maps`. That is all wasted with `panic = immediate-abort` active because `init()` immediately discards the return value from `install_main_guard()`. A similar improvement can be seen in environments that don't have `/proc`. This change is safe because the immediately succeeding comment says that we rely on Linux's "own stack-guard mechanism".

Tracking issue: rust-lang#147286

# Benchmark

Set it up with `cargo new hello-world2`, and replace these files:

```toml
# Cargo.toml
cargo-features = ["panic-immediate-abort"]

[package]
name = "hello-world"
version = "0.1.0"
edition = "2024"

[profile.release]
lto = true
panic = "immediate-abort"
codegen-units = 1
opt-level = "z"
strip = true

# .cargo/config.toml
[unstable]
build-std = ["std"]
```

## Before

```console
home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     524.8 µs ±  65.1 µs    [User: 276.1 µs, System: 187.0 µs]
  Range (min … max):   446.4 µs … 975.5 µs    3996 runs

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     519.4 µs ±  65.8 µs    [User: 282.1 µs, System: 177.7 µs]
  Range (min … max):   443.2 µs … 830.5 µs    3612 runs

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     520.0 µs ±  64.3 µs    [User: 277.1 µs, System: 182.1 µs]
  Range (min … max):   447.1 µs … 1001.3 µs    3804 runs
```

For a visualization of the problem, run `cargo +stage1 build --release && perf record --call-graph dwarf -F max ./target/release/hello-world2 && perf script | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg`:

<img width="3832" height="1216" alt="flamegraph with 17.41% __pthread_getattr_np" src="https://github.com/user-attachments/assets/acc2286e-1582-4772-9e3b-68b5c35e3e70" />

## After

```console
home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     444.7 µs ±  57.3 µs    [User: 257.4 µs, System: 130.2 µs]
  Range (min … max):   379.4 µs … 1289.3 µs    3893 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     452.3 µs ±  60.7 µs    [User: 261.5 µs, System: 133.5 µs]
  Range (min … max):   374.9 µs … 1512.4 µs    4177 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

home@daniel-desktop3:~/CLionProjects/hello-world2$ hyperfine -N target/release/hello-world2
Benchmark 1: target/release/hello-world2
  Time (mean ± σ):     441.2 µs ±  56.1 µs    [User: 256.2 µs, System: 128.8 µs]
  Range (min … max):   375.0 µs … 760.4 µs    4032 runs
```
…=Mark-Simulacrum

implement `BinaryHeap::as_mut_slice`

Tracking issue: rust-lang#154009
…ts, r=Kivooeo

ui/lto: move and rename two tests from issues/

Move:
- `tests/ui/issues/issue-44056.rs` -> `tests/ui/lto/lto-avx-target-feature.rs`
    - The first test enables both AVX target features and LTO but does not exercise AVX-specific behavior. The test primarily checks that LTO builds successfully with these flags; place it under `ui/lto` for consistency.
- `tests/ui/issues/issue-51947.rs` -> `tests/ui/lto/lto-weak-merge-functions.rs`
    - The second test exercises weak linkage interacting with LTO (merge-functions), so it should belong in `ui/lto`.

I have also added a commented line at the top of each test file indicating the issue it originated from.
…Brouwer

allow `incomplete_features` in most UI tests

This PR allows the `incomplete_features` lint for all UI tests except for the three directories with the largest number of tests (`traits`, `specialization` and `const-generics`) triggering this lint to keep the size of this PR manageable. The remaining three directories will be handled in followup PRs.

Part of rust-lang#154168.
…ulacrum

Add new alias for Guillaume Gomez email address

I'm switching to a new email account and slowly updating all references to the old one.
…tebank

diagnostics: avoid ICE for undeclared generic parameter in impl

Avoid an ICE for:

    struct A;
    impl A<B> {}

The compiler no longer panics and can proceed to emit existing diagnostics.

Adds `tests/ui/missing/undeclared-generic-parameter.rs`.

Fixes rust-lang#154165 and introduced by rust-lang#152913
…o_the_tracking_issue, r=JonathanBrouwer

Update the tracking issue for #[diagnostic::on_move]

PR rust-lang#150935 has been merged and then I have opened the tracking issue (whoops ?). So this update `compiler/rustc_feature/src/unstable.rs` to point to the right tracking issue.

This is related to the tracking issue rust-lang#154181
Use enums to clarify `DepNodeColorMap` color marking

When a function's documentation has to explain the meaning of nested results and options, then it is often a good candidate for using a custom result enum instead.

This PR also renames `DepNodeColorMap::try_mark` to `try_set_color`, to make it more distinct from the similarly-named `DepGraph::try_mark_green`.

The difference is that `try_mark_green` is a higher-level operation that tries to determine whether a node _can_ be marked green, whereas `try_set_color` is a lower-level operation that actually records a colour for the node.

The updated docs for `try_set_color` also fix a typo: *atomicaly* → *atomically*.

r? nnethercote (or compiler)
@rust-bors rust-bors bot added the rollup A PR which is a rollup label Mar 22, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) O-hermit Operating System: Hermit O-SGX Target: SGX O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.