Skip to content

Comments

Rollup of 9 pull requests#153000

Merged
rust-bors[bot] merged 19 commits intorust-lang:mainfrom
Zalathar:rollup-68jDIBK
Feb 23, 2026
Merged

Rollup of 9 pull requests#153000
rust-bors[bot] merged 19 commits intorust-lang:mainfrom
Zalathar:rollup-68jDIBK

Conversation

@Zalathar
Copy link
Member

Successful merges:

r? @ghost

Create a similar rollup

enthropy7 and others added 19 commits February 6, 2026 16:14
* Add try_shrink_to and try_shrink_to_fit to Vec

Both functions are required to support shrinking a vector in
environments without global OOM handling.
* Format the try_shrink functions
* Remove excess "```" from doc
* Remove `cfg(not(no_global_oom_handling))` from rawvecinner::shrink
* Fix import cmp even if no_global_oom_handling is defined
Remove deterministic picking from query cycle handling

This removes the deterministic picking of queries from the query cycle handling. The sets we pick from are themselves non-deterministic, making this ineffective. There may be additional entry points to the cycle which we won't discover until after we resume from the cycle handler and run more code.
…rk-Simulacrum

extend unpin noalias tests to cover mutable references

rust-lang#152946 made a change to the logic for this attribute that the test should have flagged as problematic -- but the test only checked `Box`, not `&mut`, and those have independent code paths. So extend the test to also cover `&mut`.

@b-naber would be nice if you could confirm that the added tests do fail with your PR.
…=JonathanBrouwer

stabilize `cfg_select!`

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/149783)*

tracking issue: rust-lang#115585
closes rust-lang#115585
reference PR:

- rust-lang/reference#2103

# Request for Stabilization

## Summary

The `cfg_select!` macro picks the expansion corresponding to the first `cfg` condition that evaluates to `true`. It simplifies complex conditional expressions.

```rust
cfg_select! {
    unix => {
        fn foo() { /* unix specific functionality */ }
    }
    target_pointer_width = "32" => {
        fn foo() { /* non-unix, 32-bit functionality */ }
    }
    _ => {
        fn foo() { /* fallback implementation */ }
    }
}

let is_unix_str = cfg_select! {
    unix => "unix",
    _ => "not unix",
};
println!("{is_unix_str}");
```
## Semantics

The expansion of a `cfg_select!` call is the right-hand side of the first `cfg` rule that evaluates to true.

This can be roughly expressed using this macro:
```rust
macro_rules! cfg_select {
    ({ $($tt:tt)* }) => {{
        $crate::cfg_select! { $($tt)* }
    }};
    (_ => { $($output:tt)* }) => {
        $($output)*
    };
    (
        $cfg:meta => $output:tt
        $($( $rest:tt )+)?
    ) => {
        #[cfg($cfg)]
        $crate::cfg_select! { _ => $output }
        $(
            #[cfg(not($cfg))]
            $crate::cfg_select! { $($rest)+ }
        )?
    }
}
```

The actual implementation uses a builtin macro so that `cfg_select!` can be used both in item and expression position.

## Documentation

reference PR:

- rust-lang/reference#2103

## Tests

The `cfg_select!` macro is already used extensively in the rust compiler codebase. It has several dedicated tests:

- [`tests/ui/check-cfg/cfg-select.rs`](https://github.com/rust-lang/rust/blob/main/tests/ui/check-cfg/cfg-select.rs)tests that warnings are emitted when an unexpected `cfg` condition is used.
- [`tests/ui/macros/cfg_select.rs`](https://github.com/rust-lang/rust/blob/main/tests/ui/macros/cfg_select.rs) tests that `cfg_select!` has the expected expansion, and tests that the expected syntax is accepted.
## History

- rust-lang#115416
- rust-lang#117162
- rust-lang#133720
- rust-lang#135625
- rust-lang#137198
- rust-lang#138993
- rust-lang#138996
- rust-lang#143461
- rust-lang#143941
- rust-lang#145233
- rust-lang#148712
- rust-lang#149380
- rust-lang#149925

# Resolved questions

# Unresolved questions

The style team has decided on how to format `cfg_select!`, but this formatting has not yet been implemented. See rust-lang#144323.

r? @traviscross

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_CONCERN-ISSUE_START -->

> [!NOTE]
> # Concerns (0 active)
>
> - ~~[allowing-comma-after-closing-brace](rust-lang#149783 (comment) resolved in [this comment](rust-lang#149783 (comment))
>
> *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*

<!-- TRIAGEBOT_CONCERN-ISSUE_END -->
<!-- TRIAGEBOT_END -->
…rtn, r=davidtwco

fix refining_impl_trait suggestion with return_type_notation

using `#![feature(return_type_notation)] `on top of `refining_impl_trait` made the lint suggest a pretty wild “wrap the body in `<Self as Trait>::f(..)”` fix instead of the simple “just copy the return type from the trait”. this patch makes the lint always suggest the plain return-type replacement based on the trait signature (by grabbing the original snippet when possible), so you don’t get RTN-style desugarings in the help

new test here

fixes rust-lang#151663
… r=Mark-Simulacrum

Add try_shrink_to and try_shrink_to_fit to Vec

Adds the functions `try_shrink_to` and `try_shrink_to_fit` to Vec to allow shrinking
in environments without global OOM handling.

The implementation differs from the tracking issue as the fallible methods return
a `TryReserveError` instead of an `AllocError` as `AllocError` is unstable and does
not contain layout information.

Tracking:

- rust-lang#152350
…k, r=Mark-Simulacrum

Add direct link to rustc-dev-guide in README

Adds a direct link to the rustc-dev-guide in the top-level README so new contributors can find compiler documentation faster without middle steps.

Fixes rust-lang#110144
… r=jhpratt

Revert "Stabilize `str_as_str`"

Reverts rust-lang#151603, clean revert.
Fixes rust-lang#152961
…e-check, r=JonathanBrouwer

Remove redundant call to `check_codegen_attributes_extra` in Inliner

Inside `try_inlining`, `check_codegen_attributes` is called first. This function internally invokes `check_codegen_attributes_extra`.
However, immediately after that returns, `try_inlining` calls `check_codegen_attributes_extra` again.

First call:
https://github.com/rust-lang/rust/blob/7ec34defe9e62a1a6946d3e700b5903d8dc89ece/compiler/rustc_mir_transform/src/inline.rs#L800-L814

Second call:
https://github.com/rust-lang/rust/blob/7ec34defe9e62a1a6946d3e700b5903d8dc89ece/compiler/rustc_mir_transform/src/inline.rs#L598-L612

```rust
    // Inside try_inlining:
    check_codegen_attributes(inliner, callsite, callee_attrs)?; // Internally calls `check_codegen_attributes_extra`
    inliner.check_codegen_attributes_extra(callee_attrs)?;      // Called again here
```

In `try_inlining`, inliner is held as a shared reference (`&I`). Since `check_codegen_attributes_extra` takes `&self` and does not rely on interior mutability or external state, there does not seem to be any state change between the two calls.

Therefore, the second call appears to be redundant.

Currently, `check_codegen_attributes` is only called from `try_inlining`, and `check_codegen_attributes_extra` appears to be called only from these two locations. It seems reasonable for the `check_codegen_attributes` wrapper to handle the hook automatically.
…nBrouwer

Use `HashStable` derive in more places

This applies `HashStable` derive in a couple more places. Also `stable_hasher` is declared for `HashStable_NoContext`.
@rust-bors rust-bors bot added the rollup A PR which is a rollup label Feb 23, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Feb 23, 2026
@Zalathar
Copy link
Member Author

Rollup of everything.

@bors r+ rollup=never p=5

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 23, 2026

📌 Commit 8c96521 has been approved by Zalathar

It is now in the queue for this repository.

@rust-bors rust-bors bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 23, 2026
@rust-bors rust-bors bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 23, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 23, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 23, 2026

☀️ Test successful - CI
Approved by: Zalathar
Duration: 3h 39m 14s
Pushing d3e8bd9 to main...

@rust-bors rust-bors bot merged commit d3e8bd9 into rust-lang:main Feb 23, 2026
12 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 23, 2026
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#149783 stabilize cfg_select! a4de75e57fc7ede2af7b5a2c4ff401f911438695 (link)
#151744 fix refining_impl_trait suggestion with return_type_notation d9b9afd9cca7b389d7fec448575bb17789488ddf (link)
#152229 Remove deterministic picking from query cycle handling 61885783c4d777fb69566940141bb5a70f98bd89 (link)
#152366 Add try_shrink_to and try_shrink_to_fit to Vec 3166fc1a7e7af6bbcd0d334c466aecdf20859c16 (link)
#152640 Add direct link to rustc-dev-guide in README 6733995de73cd78b479d6e9d86fd9356b7b3f156 (link)
#152963 Revert "Stabilize str_as_str" 734e27456a29223fcb9c135193c1f18f96d26677 (link)
#152970 extend unpin noalias tests to cover mutable references 9e8a55fb616b611c5186a9caad121696a334d0ca (link)
#152984 Remove redundant call to check_codegen_attributes_extra i… 4742ed2a71e99cc429cc979d6f2486a52e6ea214 (link)
#152987 Use HashStable derive in more places 322103dd50ddd1ee822058b3026420afb2e99e2e (link)

previous master: c78a29473a

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

@github-actions
Copy link
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 c78a294 (parent) -> d3e8bd9 (this PR)

Test differences

Show 1208 test diffs

Stage 1

  • [ui] tests/ui/feature-gates/feature-gate-cfg-select.rs: pass -> [missing] (J1)
  • [ui] tests/ui/impl-trait/in-trait/refine-return-type-notation.rs: [missing] -> pass (J1)
  • [ui] tests/ui/resolve/slice-as-slice.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/feature-gates/feature-gate-cfg-select.rs: pass -> [missing] (J0)
  • [ui] tests/ui/impl-trait/in-trait/refine-return-type-notation.rs: [missing] -> pass (J0)
  • [ui] tests/ui/resolve/slice-as-slice.rs: [missing] -> pass (J0)

Additionally, 1202 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 d3e8bd94cc042c65e30a6c60146a8a00531d1292 --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-aarch64-linux: 1h 47m -> 2h 29m (+39.7%)
  2. dist-aarch64-apple: 1h 55m -> 2h 16m (+18.0%)
  3. aarch64-apple: 3h 2m -> 3h 32m (+16.8%)
  4. dist-aarch64-llvm-mingw: 1h 50m -> 1h 35m (-13.2%)
  5. dist-apple-various: 2h -> 2h 15m (+13.0%)
  6. dist-aarch64-msvc: 1h 47m -> 2h 1m (+13.0%)
  7. dist-x86_64-apple: 2h 17m -> 2h 2m (-11.0%)
  8. aarch64-gnu-llvm-20-2: 46m 38s -> 50m 58s (+9.3%)
  9. x86_64-mingw-1: 2h 38m -> 2h 52m (+8.7%)
  10. aarch64-msvc-1: 1h 55m -> 2h 4m (+7.8%)
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
Collaborator

Finished benchmarking commit (d3e8bd9): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -1.4%, secondary -0.5%)

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)
5.3% [5.3%, 5.3%] 1
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-2.5% [-2.9%, -1.9%] 3
All ❌✅ (primary) -1.4% [-1.4%, -1.4%] 1

Cycles

Results (primary -2.3%)

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)
- - 0
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 479.878s -> 480.206s (0.07%)
Artifact size: 397.87 MiB -> 397.91 MiB (0.01%)

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.