Skip to content

Rollup of 9 pull requests - #161715

Closed
Zalathar wants to merge 26 commits into
rust-lang:mainfrom
Zalathar:rollup-AxIobGh
Closed

Rollup of 9 pull requests#161715
Zalathar wants to merge 26 commits into
rust-lang:mainfrom
Zalathar:rollup-AxIobGh

Conversation

@Zalathar

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

TDecking and others added 26 commits August 9, 2026 22:54
…ing methods

Newly implemented/adjusted:
- vectored read/write
- file locking
- native paths (bin/tmp)
- command output
- process pid
…crum

dirfd dir operations (3/4)

Previous PR: rust-lang#150679
Reference: rust-lang#139514
Tracking issue: rust-lang#120426
library: motor: bump moto-rt ABI ver to 17

Newly added features:

- vectored read/write
- file locking
- native paths (bin/tmp/home)
- command output
- process pid
interpret: fix after_local_read handling

`after_local_read` handling was wrong in two ways:
- Contrary to what was documented, we invoked it for all reads of locals, not just reads of locals that have their values stored as immediates (without memory).
- Miri effectively ignored the `frame` we are passing to it. And indeed we never want this called on anything but the current frame, also for consistency with the corresponding write hook.

So let's restrict `local_to_op` to the current frame.
Debuggers/visualizers should be able to use the existing method on `LocalState` that Miri also needs for its provenance visitor. Its name was not sufficiently scary for skipping access hooks, so I also overhauled how we name these "fake"/"ghost" access related APIs.
Rework `div_ceil` for nonzero integers

This changes the definition of `NonZero::div_ceil` for improved performance by employing a different algorithm.
The generated assembly is better in nearly every case, with the exception of the division by a constant 2, which gains one instruction.

<details>

<summary>Assembly</summary>

```asm
div_ceil_16_new:
        lea     rax, [rdi - 1]
        shr     rax, 4
        inc     rax
        ret

div_ceil_16_old:
        mov     rax, rdi
        shr     rax, 4
        and     edi, 15
        cmp     rdi, 1
        sbb     rax, -1
        ret

div_ceil_21_new:
        lea     rcx, [rdi - 1]
        movabs  rdx, -8784163844623596007
        mov     rax, rcx
        mul     rdx
        sub     rcx, rdx
        shr     rcx
        add     rcx, rdx
        shr     rcx, 4
        inc     rcx
        mov     rax, rcx
        ret

div_ceil_21_old:
        movabs  rcx, -8784163844623596007
        mov     rax, rdi
        mul     rcx
        movabs  rcx, -3513665537849438403
        imul    rcx, rdi
        sub     rdi, rdx
        shr     rdi
        add     rdi, rdx
        shr     rdi, 4
        movabs  rdx, 878416384462359600
        xor     eax, eax
        cmp     rcx, rdx
        seta    al
        add     rax, rdi
        ret

div_ceil_2_new:
        lea     rax, [rdi - 1]
        shr     rax
        inc     rax
        ret

div_ceil_2_old:
        mov     rax, rdi
        mov     rcx, rdi
        shr     rcx
        sub     rax, rcx
        ret

div_ceil_3_new:
        lea     rax, [rdi - 1]
        movabs  rcx, -6148914691236517205
        mul     rcx
        shr     rdx
        lea     rax, [rdx + 1]
        ret

div_ceil_3_old:
        mov     rax, rdi
        movabs  rcx, -6148914691236517205
        mul     rcx
        shr     rdx
        movabs  rsi, 6148914691236517205
        xor     ecx, ecx
        cmp     rax, rsi
        seta    cl
        add     rcx, rdx
        mov     rax, rcx
        ret

div_ceil_generic_new:
        mov     rax, rdi
        dec     rax
        mov     rcx, rax
        or      rcx, rsi
        shr     rcx, 32
        je      .LBB8_1
        xor     edx, edx
        div     rsi
        inc     rax
        ret
.LBB8_1:
        xor     edx, edx
        div     esi
        inc     rax
        ret

div_ceil_generic_old:
        mov     rax, rdi
        mov     rcx, rdi
        or      rcx, rsi
        shr     rcx, 32
        je      .LBB9_1
        xor     edx, edx
        div     rsi
        cmp     rdx, 1
        sbb     rax, -1
        ret
.LBB9_1:
        xor     edx, edx
        div     esi
        cmp     rdx, 1
        sbb     rax, -1
        ret
```

</details>

It is theoretically possible to adapt this algorithm for normal unsigned integers and possibly even signed normal integers,
but the results were questionable at best, which is why the change was restricted to unsigned nonzero integers.
…, r=tgross35

run `classify-runtime-const` test for `f128`

This seems to work now, at least locally on linux and windows-gnu.

@bors try jobs=test-various,aarch64-apple-*,*-gnu-nopt-*,x86_64-mingw-*,aarch64-msvc-*,arm-android
…ouxu

renovate: add lockfile update warning
…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.
…, r=ytmimi

Stop rustfmt deleting attributes in fn params

Currently, rustfmt deletes attributes in function type parameters, for example:
```rust
type F = fn(#[rustc_splat] ());
```

Becomes:
```rust
type F = fn(());
```

[Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f56e4727022f44a6e5c937c1521830f9)

This is an annoying and confusing bug, and causes formatted code to silently change meaning, or fail compilation.

This PR cherry-picks the fix and tests from rust-lang/rustfmt#6590 to `rust-lang/rust`.

We're discussing a potential beta backport in [Zulip #t-rustfmt > Attributes in fn type deleted on stable but not nightly](https://rust-lang.zulipchat.com/#narrow/channel/357797-t-rustfmt/topic/Attributes.20in.20fn.20type.20deleted.20on.20stable.20but.20not.20nightly/with/618688539), which is why this PR is separate to the subtree sync.

Tracking issue: rust-lang#153629
- This formatting bug impacts splatted function pointers
- We just published [a "call for experiment" blog post](https://blog.rust-lang.org/inside-rust/2026/08/19/overloading-experiment/), including experiments with splatted function pointers

r? @ytmimi
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Aug 25, 2026
@rustbot rustbot added O-unix Operating system: Unix-like 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. labels Aug 25, 2026
@rustbot rustbot added 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 Aug 25, 2026
@Zalathar

Copy link
Copy Markdown
Member Author

Rollup of everything.

(I'm incorporating both iffy PRs because crashtest failures should be easy to triage.)

@bors r+ rollup=never p=5

@rust-bors

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit e82fcf0 has been approved by Zalathar

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 25, 2026
@rust-bors

This comment has been minimized.

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

Successful merges:

 - #160533 (dirfd dir operations (3/4))
 - #161294 (add crashtests [6/N])
 - #160392 (library: motor: bump moto-rt ABI ver to 17)
 - #161646 (interpret: fix after_local_read handling)
 - #160819 (Rework `div_ceil` for nonzero integers)
 - #161591 (run `classify-runtime-const` test for `f128`)
 - #161680 (renovate: add lockfile update warning)
 - #161702 (Use `drop_guard` in some places in {core,alloc,std})
 - #161709 (Stop rustfmt deleting attributes in fn params)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job dist-various-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    |                                                                  ^ unknown field
    |
    = note: available field is: `inner`

error[E0609]: no field `0` on type `DropGuard<&mut MaybeUninit<pthread_condattr_t>, {closure@...}>`
   --> /rustc/be9b4b41459108be98f9e1cf06d1714a4ba4147d/library/std/src/sys/pal/unix/sync/condvar.rs:163:58
    |
163 |             let r = libc::pthread_condattr_setclock(attr.0.as_mut_ptr(), Self::CLOCK);
    |                                                          ^ unknown field
    |
    = note: the full name for the type has been written to '/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/wasm32-unknown-emscripten/dist/build/std/b6240879962d56b7/out/std-b6240879962d56b7.long-type-887120436078809664.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0609]: no field `0` on type `DropGuard<&mut MaybeUninit<pthread_condattr_t>, {closure@...}>`
   --> /rustc/be9b4b41459108be98f9e1cf06d1714a4ba4147d/library/std/src/sys/pal/unix/sync/condvar.rs:165:62
    |
165 |             let r = libc::pthread_cond_init(self.raw(), attr.0.as_ptr());
    |                                                              ^ unknown field
    |
    = note: the full name for the type has been written to '/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/wasm32-unknown-emscripten/dist/build/std/b6240879962d56b7/out/std-b6240879962d56b7.long-type-887120436078809664.txt'
    = note: consider using `--verbose` to print the full type name to the console

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

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

💔 Test for be9b4b4 failed: CI. Failed job:

@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-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2026
@rust-bors

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

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

@Zalathar Zalathar closed this Aug 25, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 25, 2026
@Zalathar
Zalathar deleted the rollup-AxIobGh branch August 25, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like 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. 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.