Skip to content

Rollup of 7 pull requests - #161844

Closed
jhpratt wants to merge 15 commits into
rust-lang:mainfrom
jhpratt:rollup-opcvQBL
Closed

Rollup of 7 pull requests#161844
jhpratt wants to merge 15 commits into
rust-lang:mainfrom
jhpratt:rollup-opcvQBL

Conversation

@jhpratt

@jhpratt jhpratt commented Aug 27, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

Kyuuhachi and others added 15 commits August 22, 2026 12:31
Remove trivial bounds

Panic on NaN

Make assert messages consistent with field names

Add clamp_to coretests

Update to fmt style

Use target_has_reliable_fN_math

Change existing clamp tests to use reliable_math

Use reliable_math on doctests too
This check is called from a few different places when coverage is enabled, so
we should probably let the query system take care of memoizing results and
tracking dependencies.
```
warning: explicit `package.readme` can be inferred
  --> compiler/rustc_thread_pool/Cargo.toml:11:1
   |
11 | readme = "README.md"
   | ^^^^^^^^^^^^^^^^^^^^
   |
   = note: `cargo::manual_readme` is set to `warn` by default
help: consider removing `package.readme`
warning: `rustc_thread_pool` (manifest) generated 1 warning
```

See
<https://triage.rust-lang.org/gha-logs/rust-lang/rust/98030530980#L2026-08-26T03:05:00.5401170Z-L2026-08-26T03:05:00.5402963Z>
```
warning: unused dependency `unified-diff`
  --> src/tools/compiletest/Cargo.toml:37:1
   |
37 | unified-diff = "0.2.1"
   | ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `cargo::unused_dependencies` is set to `warn` by default
help: consider removing the dependency on `unified-diff`
warning: `compiletest` (manifest) generated 1 warning
```

See
<https://triage.rust-lang.org/gha-logs/rust-lang/rust/98030530980#L2026-08-26T03:05:07.8912904Z-L2026-08-26T03:05:07.8915112Z>
Implement clamp_to

Implements the revised version of rust-lang#147781. Supersedes rust-lang#147786.

Currently I restrict the ClampBounds trait using a second, perma-unstable feature. I don't know if that's the usual way to deal with this kind of traits, I'd be happy to change it if not.

~~I currently define NaN as equal to no bound. This is consistent with `max` and `min`, but is inconsistent with `clamp`, which panics.~~

Changed so that the float versions panic if any bound is NaN, just like `clamp` does.
Add SVE-accelerated Vec::retain_mut for aarch64

The PR adds SVE support for specified width types(8, 16, 32 and 64 bits) in `Vec::retain_mut`. Due to [pointer provenance being stripped by intrinsics](https://rust-lang.zulipchat.com/#narrow/channel/208962-t-libs.2Fstdarch/topic/MaybeUninit.20lane.20variants.20for.20vector.20data-movement.20intrinsic/with/615526760)) here it has to use inline asm instead of sve intrinsics.

## 1. retain half (ns/iter)

| Elements | u32 SVE | u32 scalar | Change | u64 SVE | u64 scalar | Change |
|---|---|---|---|---|---|---|
| 4 | 10.32 | 12.36 | / | 10.25 | 11.83 | / |
| 8 | 12.93 | 15.08 | / | 13.40 | 14.74 | / |
| 16 | 18.66 | 19.46 | / | 19.08 | 18.89 | / |
| 32 | 31.84 | 31.12 |/ | 31.78 | 31.26 | / |
| 64 | 32.99 | 59.17 | **-44.2%** | 59.86 | 59.44 | / |
| 1,000 | 471.51 | 811.71 | **-41.9%** | 820.98 | 827.16 | / |
| 10,000 | 4,660 | 7,990 | **-41.7%** | 5,836 | 8,242 | **-29.2%** |
| 100,000 | 46,414 | 79,608 | **-41.7%** | 57,561 | 82,861 | **-30.5%** |

## 2. retain whole

| Elements | u32 SVE | u32 scalar | Change | u64 SVE | u64 scalar | Change |
|---|---|---|---|---|---|---|
| 4 | 3.46 | 3.11 | / | 3.45 | 3.45 | / |
| 8 | 4.90 | 4.49 | / | 4.83 | 6.22 | / |
| 16 | 8.44 | 8.14 | / | 8.44 | 11.74 | / |
| 32 | 15.83 | 15.51 | / | 15.83 | 22.79 | / |
| 64 | 21.57 | 30.66 | **-29.6%** | 30.72 | 44.89 | / |
| 1,000 | 358.53 | 483.33 | **-25.8%** | 469.18 | 696.43 | / |
| 10,000 | 3,127 | 4,745 | **-34.1%** | 5,082 | 6,912 | **-26.5%** |
| 100,000 | 32,509 | 49,501 | **-34.3%** | 49,484 | 79,749 | **-38.0%** |

r? @Amanieu
…ethlin

interpret: ensure that calls via no-unwind ABIs do not unwind

According to our [ABI docs](https://doc.rust-lang.org/nightly/std/primitive.fn.html#abi-compatibility), programs like this are okay:
```rust
extern "C-unwind" fn does_not_unwind_but_could() {}

fn main() {
    let f: extern "C-unwind" fn() = does_not_unwind_but_could;
    let f: extern "C" fn() = unsafe { std::mem::transmute(f) };
    f();
}
```
So let's add a test for that.

And also, let's adjust the checks in Miri's shims accordingly (see `src/tools/miri/src/shims/sig.rs`). We used to reject calls to functions that *might* unwind with a signature that does not allow unwinding, even if no unwinding occurred. I don't think we have an actual example of a potentially-unwinding shim with an ABI that has a compatible ABI that does not allow unwinding ("C-unwind" and "C"), so we can't add a test for this.
…_aliases, r=adwinwhite

borrowck: Normalize non-rigid aliases in NLL type relating

Fixes rust-lang#160652

With `-Znext-solver=globally`, yielding from an `impl Iterator` without an explicit `Item` bound ICEs in borrowck. The coroutine defining type returned by `type_of` is unnormalized, so its yield type remains `<impl Iterator as Iterator>::Item`. Skipping normalization propagates that non-rigid alias into both MIR's `CoroutineInfo` and borrowck's `UniversalRegions`; NLL type relating then hits its invariant that non-rigid aliases must already have been normalized.

Deeply normalize the instantiated defining type when MIR construction creates `CoroutineInfo` and when borrowck reconstructs `DefiningTy`. That makes the coroutine yield and resume types rigid before NLL compares them.

This is intentionally gated to the next solver. The old solver keeps the existing skip-normalization path because deeply normalizing defining types there causes regressions.
…they

Use `drop_guard` in some places in {core,alloc,std}

- Tracking issue: rust-lang#144426
- Will conflict with rust-lang#161520
- rust-lang#161550 would also be cool occasionally

Didn't touch the places where manual `impl Drop`s had `#[inline]` on their `fn drop` or where the guard type had other `impl`s beside `Drop` and/or was named a lot.

No LLMs used, only pure human slop.
…ouwer

Change `is_eligible_for_coverage` from a hook to a query

- Inspired by seeing rust-lang#161808 add more eligibility conditions
---

This check is called from a few different places when coverage is enabled, so we should probably let the query system take care of memoizing results and tracking dependencies.

(It was made a hook in rust-lang#122322, but I didn't have strong reasons for making it a hook and not a query, other than it being relatively small and simple.)

There should be no user-visible change to compiler behaviour.
chore: fix cargo lints

Fixes two cargo lint erros found during <rust-lang#161789 (comment)>.

See each commit message respectively for details.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Aug 27, 2026
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like 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-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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 27, 2026
@jhpratt

jhpratt commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@bors r+ p=5

@rust-bors

rust-bors Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b1ad46c has been approved by jhpratt

It is now in the queue for this repository.

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

rust-bors Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

⌛ Testing commit b1ad46c with merge b3e5574...

Workflow: https://github.com/rust-lang/rust/actions/runs/33035009605

rust-bors Bot pushed a commit that referenced this pull request Aug 27, 2026
Rollup of 7 pull requests

Successful merges:

 - #150075 (Implement clamp_to)
 - #161034 (Add SVE-accelerated Vec::retain_mut for aarch64)
 - #161628 (interpret: ensure that calls via no-unwind ABIs do not unwind)
 - #161012 (borrowck: Normalize non-rigid aliases in NLL type relating)
 - #161702 (Use `drop_guard` in some places in {core,alloc,std})
 - #161813 (Change `is_eligible_for_coverage` from a hook to a query)
 - #161842 (chore: fix cargo lints)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.296
error: the use of negated comparison operators on partially ordered types produces code that is hard to read and refactor, please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable
    --> library/core/src/cmp/clamp.rs:89:13
     |
  65 | / macro impl_for_float($t:ty) {
  66 | |     #[unstable(feature = "clamp_bounds", issue = "147781")]
  67 | |     #[rustc_const_unstable(feature = "clamp_bounds", issue = "147781")]
  68 | |     const impl ClampBounds<$t> for RangeFrom<$t> {
...    |
  89 | |             assert!(start <= end, "start > end, or either was NaN");
     | |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
...    |
  93 | | }
     | |_- in this expansion of `impl_for_float!` (#1)
...
  96 |   impl_for_float!(f16);
     |   -------------------- in this macro invocation (#1)
     |
    ::: library/core/src/macros/mod.rs:1738:5
     |
1738 | /     macro_rules! assert {
1739 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1740 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
1741 | |     }
     | |_____- in this expansion of `assert!` (#2)
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#neg_cmp_op_on_partial_ord
     = note: requested on the command line with `-D clippy::neg-cmp-op-on-partial-ord`

error: the use of negated comparison operators on partially ordered types produces code that is hard to read and refactor, please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable
    --> library/core/src/cmp/clamp.rs:89:13
     |
  65 | / macro impl_for_float($t:ty) {
  66 | |     #[unstable(feature = "clamp_bounds", issue = "147781")]
  67 | |     #[rustc_const_unstable(feature = "clamp_bounds", issue = "147781")]
  68 | |     const impl ClampBounds<$t> for RangeFrom<$t> {
...    |
  89 | |             assert!(start <= end, "start > end, or either was NaN");
     | |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
...    |
  93 | | }
     | |_- in this expansion of `impl_for_float!` (#1)
...
  97 |   impl_for_float!(f32);
     |   -------------------- in this macro invocation (#1)
     |
    ::: library/core/src/macros/mod.rs:1738:5
     |
1738 | /     macro_rules! assert {
1739 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1740 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
1741 | |     }
     | |_____- in this expansion of `assert!` (#2)
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#neg_cmp_op_on_partial_ord

error: the use of negated comparison operators on partially ordered types produces code that is hard to read and refactor, please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable
    --> library/core/src/cmp/clamp.rs:89:13
     |
  65 | / macro impl_for_float($t:ty) {
  66 | |     #[unstable(feature = "clamp_bounds", issue = "147781")]
  67 | |     #[rustc_const_unstable(feature = "clamp_bounds", issue = "147781")]
  68 | |     const impl ClampBounds<$t> for RangeFrom<$t> {
...    |
  89 | |             assert!(start <= end, "start > end, or either was NaN");
     | |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
...    |
  93 | | }
     | |_- in this expansion of `impl_for_float!` (#1)
...
  98 |   impl_for_float!(f64);
     |   -------------------- in this macro invocation (#1)
     |
    ::: library/core/src/macros/mod.rs:1738:5
     |
1738 | /     macro_rules! assert {
1739 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1740 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
1741 | |     }
     | |_____- in this expansion of `assert!` (#2)
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#neg_cmp_op_on_partial_ord

error: the use of negated comparison operators on partially ordered types produces code that is hard to read and refactor, please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable
    --> library/core/src/cmp/clamp.rs:89:13
     |
  65 | / macro impl_for_float($t:ty) {
  66 | |     #[unstable(feature = "clamp_bounds", issue = "147781")]
  67 | |     #[rustc_const_unstable(feature = "clamp_bounds", issue = "147781")]
  68 | |     const impl ClampBounds<$t> for RangeFrom<$t> {
...    |
  89 | |             assert!(start <= end, "start > end, or either was NaN");
     | |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation (#2)
...    |
  93 | | }
     | |_- in this expansion of `impl_for_float!` (#1)
...
 100 |   impl_for_float!(f128);
     |   --------------------- in this macro invocation (#1)
     |
    ::: library/core/src/macros/mod.rs:1738:5
     |
1738 | /     macro_rules! assert {
1739 | |         ($cond:expr $(,)?) => {{ /* compiler built-in */ }};
1740 | |         ($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};
1741 | |     }
     | |_____- in this expansion of `assert!` (#2)
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#neg_cmp_op_on_partial_ord

@jhpratt jhpratt mentioned this pull request Aug 27, 2026
@jhpratt jhpratt closed this Aug 27, 2026
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 27, 2026
@rust-bors

rust-bors Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

PR #150075, which is a member of this rollup, was unapproved.

This rollup was thus unapproved.

Auto build was cancelled due to unapproval. Cancelled workflows:

@jhpratt
jhpratt deleted the rollup-opcvQBL branch August 27, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants