Skip to content

Rollup of 9 pull requests - #160810

Closed
JonathanBrouwer wants to merge 19 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-jZmmVoM
Closed

Rollup of 9 pull requests#160810
JonathanBrouwer wants to merge 19 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-jZmmVoM

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

folkertdev and others added 19 commits July 22, 2026 23:57
It was never used in that crate, so rustc_parse is the next obvious place to go. It's also used by rustc_hir_typeck, but sharing diagnostics between crates makes it easy for such things to become dead, so duplicate it.
…g fs functions to utilize with_native_path, and move exists to use with_native_path
And fix support for multi-line attributes. And add some tests.
rustc_attr_ir: fix up `lang_items` imports

Cleanup after splitting attributes from rustc_hir.

It's a big one and maybe annoying to merge without conflicts but I figured it's best to just get it done and over with. If it turns out to be too big to merge at once it should be possible to split it up tho :>

r? @JonathanBrouwer
…ked-functions, r=tiif

stabilize `c_variadic_naked_functions`

tracking issue: rust-lang#148767
reference PR: rust-lang/reference#2321

# Stabilization report

## Summary

Stabilize the ability to use `#[unsafe(naked)]` functions to define c-variadic functions. These c-variadic naked functions accept the same set of ABIs as c-variadic foreign functions, this set is larger than what we currently accept for c-variadic definitions.

```rust
#[unsafe(naked)]
unsafe extern "aapcs" fn variadic_aapcs(_: f64, _: ...) -> f64 {
    core::arch::naked_asm!(
        r#"
        sub     sp, sp, rust-lang#12
        stmib   sp, {{r2, r3}}
        vmov    d0, r0, r1
        add     r0, sp, rust-lang#4
        vldr    d1, [sp, rust-lang#4]
        add     r0, r0, rust-lang#15
        bic     r0, r0, rust-lang#7
        vadd.f64        d0, d0, d1
        add     r1, r0, rust-lang#8
        str     r1, [sp]
        vldr    d1, [r0]
        vadd.f64        d0, d0, d1
        vmov    r0, r1, d0
        add     sp, sp, rust-lang#12
        bx      lr
    "#,
    )
}
```

## Accepted ABIs

The set of accepted ABIs is the same as for c-variadic foreign functions, defined as rule [`items.extern.variadic.conventions`](https://doc.rust-lang.org/nightly/reference/items/external-blocks.html?highlight=externblo#r-items.extern.variadic.conventions):

- `"aapcs"`
- `"C"`
- `"cdecl"`
- `"efiapi"`
- `"system"`
- `"sysv64"`
- `"win64"`

And their corresponding `-unwind` variants. Given that naked functions desugar to a block of module assembly and a foreign definition, it makes sense to support the same set as source-level foreign definitions.

For c-variadic definitions we only accept `"C"` and `"C-unwind"`.

## Multiple c-variadic ABIs in the same program

LLVM supports c-variadic calls of different ABIs in the same program. We test both an arm and x86 configuration

- https://github.com/rust-lang/rust/blob/771916f9028e7fe56d2685f2c4f698de5d7d6a45/tests/ui/c-variadic/same-program-multiple-abis-arm.rs
- https://github.com/rust-lang/rust/blob/771916f9028e7fe56d2685f2c4f698de5d7d6a45/tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs

Note that GCC, Clang and LLVM do not support c-variadic definitions of multiple ABIs: the `va_start`, `va_arg` etc. macros are always expanded using the default C calling convention. Clang and GCC reject a variable argument list on definitions that use a non-default calling convention.

## History

- [#t-lang > C-variadic naked functions](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/C-variadic.20naked.20functions/with/554593886)
- rust-lang#148770

The stabilization report of `feature(c_variadic)` mentions this feature:

- rust-lang#155697

## Unresolved questions

None.
… r=Mark-Simulacrum

Implemented different with_native_path conversion methods, refactoring fs functions to utilize with_native_path, and move exists to use with_native_path

This PR attempts to complete the FIXME comment on trying to introduce the different conversion functions of `with_native_path` on all supported platforms and also moves the `exists` filesystem functions to utilize `with_native_path`. It should be easier to make `readdir` and `remove_dir_all` utilize `with_native_path`, which I'm down to support that transition in a separate PR.

I took note on what each platform fs functions does underneath the hood to decide the argument it should take:
* On Hermit and Vexos they use `run_path_with_cstr` just like Unix, so it was clear for their fs functions to take a `&CStr`
* Motor always converts the `&Path` to `&str`, so I just changed the arguments to `&str`
* Solid uses an internal `cstr` function that converts a `&Path` to `io::Result<CString>`, so I made its fs functions take in a `&CStr` anyways
* On uefi, as far as I'm aware every of its fs function ends up calling `crate::path::absolute`(returns a `Result<PathBuf>`) or `uefi_fs::File::from_path`, which calls on `crate::path::absolute` anyways, so it made sense for me to make its fs functions take a `PathBuf`.

I did some other refactoring such as putting `with_native_path` functions within `std/src/sys/path` (except for `unsupported.rs` which has `with_native_path` implemented within its file). I thought it made sense to centralize the different `with_native_path` (aside from `run_path_with_cstr` can just use the alias `with_native_path`)  functions there considering that's done for Windows. I also renamed the `unsupported_backslash.rs` file to `solid.rs` because it seems like solid is the only one that utilizes that file; the `unix.rs` file was renamed to `common.rs` because that's used by unix platforms, motor, and other miscellaneous platforms (motor platform has a different `with_native_path` implementation however).

If there's anything here that I should revert or change from platform to platform, just let me know.
…idy, r=Mark-Simulacrum

Refactor tidy detection of stability attribute

And fix support for multi-line attributes. And add some tests.

Necessary for rust-lang#160108 which confused tidy.
…r=JonathanBrouwer

make more diagnostic structs pub(crate)
…nBrouwer

Add regression test for cycle error on guaranteed unsized self type

Closes rust-lang#116914 the solver now detects the cycle and errors, which this pins
arm64ec: `f128` is supported since LLVM 23

tracking issue: rust-lang#116909

- [x] I did not use an LLM to create a change in this PR.
- [ ] I used an LLM to create a change in this PR, and I have explained below how it was used.

Related

- llvm/llvm-project#94434
- llvm/llvm-project#206980

cc @dpaoliello (feel free to approve also, and maybe you can validate this in practice?)
r? tgross35
Add regression test for save temps ICE on incremental recompile

Closes rust-lang#66367 adds an incremental regression test for adding -C save-tempsthat used to ICE
…=Mark-Simulacrum

User facing .expect now follows “expect as precondition" style

Related issue: rust-lang#159751

Updated .expect error message in std/src/net/tcp.rs to follow “expect as precondition" style.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Aug 9, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-tidy Area: The tidy tool PG-exploit-mitigations Project group: Exploit mitigations 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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 9, 2026
@rustbot rustbot added the WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) label Aug 9, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor Author

@bors r+ p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple-1,aarch64-apple-2,x86_64-mingw-1,i686-msvc-1,i686-msvc-2

@rust-bors

rust-bors Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 63794e0 has been approved by JonathanBrouwer

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

This comment has been minimized.

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


try-job: dist-various-1
try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple-1
try-job: aarch64-apple-2
try-job: x86_64-mingw-1
try-job: i686-msvc-1
try-job: i686-msvc-2
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)

error[E0507]: cannot move out of `old`, a captured variable in an `Fn` closure
  --> library/std/src/sys/fs/mod.rs:75:75
   |
75 |     with_native_path(old, &|old| with_native_path(new, &|new| imp::rename(old, new)))
   |                             ---                         -----             ^^^ `old` is moved here
   |                             |                           |
   |                             |                           captured by this `Fn` closure
   |                             captured outer variable
   |                             move occurs because `old` has type `PathBuf`, which does not implement the `Copy` trait
   |
   = help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once
help: consider cloning the value if the performance cost is acceptable
   |
75 |     with_native_path(old, &|old| with_native_path(new, &|new| imp::rename(old.clone(), new)))
   |                                                                              ++++++++

error[E0507]: cannot move out of `original`, a captured variable in an `Fn` closure
   --> library/std/src/sys/fs/mod.rs:100:53
    |
 99 |     with_native_path(original, &|original| {
    |                                  --------
    |                                  |
    |                                  captured outer variable
    |                                  move occurs because `original` has type `PathBuf`, which does not implement the `Copy` trait
100 |         with_native_path(link, &|link| imp::symlink(original, link))
    |                                 ------              ^^^^^^^^ `original` is moved here
    |                                 |
    |                                 captured by this `Fn` closure
    |
    = help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once
help: consider cloning the value if the performance cost is acceptable
    |
100 |         with_native_path(link, &|link| imp::symlink(original.clone(), link))
    |                                                             ++++++++

error[E0507]: cannot move out of `original`, a captured variable in an `Fn` closure
   --> library/std/src/sys/fs/mod.rs:106:50
    |
105 |     with_native_path(original, &|original| {
    |                                  --------
    |                                  |
    |                                  captured outer variable
    |                                  move occurs because `original` has type `PathBuf`, which does not implement the `Copy` trait
106 |         with_native_path(link, &|link| imp::link(original, link))
    |                                 ------           ^^^^^^^^ `original` is moved here
    |                                 |
    |                                 captured by this `Fn` closure
    |
    = help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once
help: consider cloning the value if the performance cost is acceptable
    |
106 |         with_native_path(link, &|link| imp::link(original.clone(), link))
    |                                                          ++++++++

For more information about this error, try `rustc --explain E0507`.
[RUSTC-TIMING] std test:false 2.503
warning: `std` (lib) generated 1 warning

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

rust-bors Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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

This rollup was thus unapproved.

@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 9, 2026
@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 9, 2026
@rust-bors

rust-bors Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

💔 Test for fd0bd4d failed: CI. Failed job:

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-tidy Area: The tidy tool PG-exploit-mitigations Project group: Exploit mitigations 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-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-rustdoc Relevant to the rustdoc 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.

9 participants