Skip to content

Rollup of 9 pull requests #142533

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 21 commits into from

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Jun 15, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

bjorn3 and others added 21 commits June 3, 2025 10:04
And move passing it to the linker to the driver code.
This deduplicates some code between codegen backends and may in the
future allow adding extra metadata that is only known at link time.
…ork, r=workingjubilee,saethlin

Move metadata object generation for dylibs to the linker code

This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time.

Prerequisite of rust-lang#96708.
Handle win32 separator for cygwin paths

This PR handles a issue that cygwin actually supports Win32 path, so we need to handle the Win32 prefix and separaters.

r? ``@mati865``

cc ``@jeremyd2019``

~~Not sure if I should handle the prefix like the windows target... Cygwin *does* support win32 paths directly going through the APIs, but I think it's not the recommended way.~~

Here I just use `cygwin_conv_path` because it handles both cygwin and win32 paths correctly and convert them into absolute POSIX paths.

UPDATE: Windows path prefix is handled.
…-live-dead-fix, r=oli-obk

Async drop - fix for StorageLive/StorageDead codegen for pinned future

Fixes: rust-lang#140429, Fixes: rust-lang#140531, Fixes: rust-lang#141761, Fixes: rust-lang#141409.

StorageLive/StorageDead codegen is corrected for pinned async drop future.
Try unremapping compiler sources

See [#t-compiler/help > Span pointing to wrong file location (`rustc-dev` component)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Span.20pointing.20to.20wrong.20file.20location.20.28.60rustc-dev.60.20component.29/with/521087083).

This PR is a follow-up to rust-lang#141751 regarding the compiler side.

Specifically we now take into account the `CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR` env from rust-lang#141751 when trying to unremap sources from `$sysroot/lib/rustlib/rustc-src/rust` (the `rustc-dev` component install directory).

Best reviewed commit by commit.

cc ``@samueltardieu``
r? ``@jieyouxu``
Apply ABI attributes on return types in `rustc_codegen_cranelift`

- The [x86-64 System V ABI standard](https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/master/raw/x86-64-ABI/abi.pdf?job=build) doesn't sign/zero-extend integer arguments or return types.
- But the de-facto standard as implemented by Clang and GCC is to sign/zero-extend arguments to 32 bits (but not return types).
- Additionally, Apple targets [sign/zero-extend both arguments and return values to 32 bits](https://developer.apple.com/documentation/xcode/writing-64-bit-intel-code-for-apple-platforms#Pass-arguments-to-functions-correctly).
- However, the `rustc_target` ABI adjustment code currently [unconditionally extends both arguments and return values to 32 bits](https://github.com/rust-lang/rust/blame/e703dff8fe220b78195c53478e83fb2f68d8499c/compiler/rustc_target/src/callconv/x86_64.rs#L240) on all targets.
- This doesn't cause a miscompilation when compiling with LLVM as LLVM will ignore the `signext`/`zeroext` attribute when applied to return types on non-Apple x86-64 targets.
- Cranelift, however, does not have a similar special case, requiring `rustc` to set the argument extension attribute correctly.
- However, `rustc_codegen_cranelift` doesn't currently apply ABI attributes to return types at all, meaning `rustc_codegen_cranelift` will currently miscompile `i8`/`u8`/`i16`/`u16` returns on x86-64 Apple targets as those targets require sign/zero-extension of return types.

This PR fixes the bug(s) by making the `rustc_target` x86-64 System V ABI only mark return types as sign/zero-extended on Apple platforms, while also making `rustc_codegen_cranelift` apply ABI attributes to return types. The RISC-V and s390x C ABIs also require sign/zero extension of return types, so this will fix those targets when building with `rustc_codegen_cranelift` too.

r? ``@bjorn3``
Add `f16` inline asm support for LoongArch

r? ``@Amanieu``
bump std libc dependency

Bump libc, it contains prerequisites for a rust-lang#140867 fix
@rustbot rustbot added 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-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc 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. labels Jun 15, 2025
@rustbot rustbot added the rollup A PR which is a rollup label Jun 15, 2025
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

📌 Commit 57654d4 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors 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 Jun 15, 2025
@bors
Copy link
Collaborator

bors commented Jun 15, 2025

⌛ Testing commit 57654d4 with merge 07029f5...

bors added a commit that referenced this pull request Jun 15, 2025
Rollup of 9 pull requests

Successful merges:

 - #133952 (Remove wasm legacy abi)
 - #141769 (Move metadata object generation for dylibs to the linker code )
 - #141864 (Handle win32 separator for cygwin paths)
 - #142347 (Async drop - fix for StorageLive/StorageDead codegen for pinned future)
 - #142377 (Try unremapping compiler sources)
 - #142389 (Apply ABI attributes on return types in `rustc_codegen_cranelift`)
 - #142470 (Add some missing mailmap entries)
 - #142481 (Add `f16` inline asm support for LoongArch)
 - #142509 (bump std libc dependency)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-20-3 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/abi/large-byval-align.rs ... ok
test [ui] tests/ui/abi/issues/issue-97463-broken-abi-leaked-uninit-data.rs ... ok
test [ui] tests/ui/abi/mir/mir_codegen_calls_variadic.rs ... ok
test [ui] tests/ui/abi/nullable-pointer-ffi-compat.rs ... ok
test [ui] tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.rs#apple ... ignored, only executed when the target vendor is Apple
test [ui] tests/ui/abi/numbers-arithmetic/i128-ffi.rs ... ok
test [ui] tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.rs#other ... ok
test [ui] tests/ui/abi/numbers-arithmetic/return-float.rs ... ok
test [ui] tests/ui/abi/relocation_model_pic.rs ... ok
test [ui] tests/ui/abi/riscv-discoverability-guidance.rs#riscv32 ... ok
test [ui] tests/ui/abi/rust-cold-works-with-rustic-args.rs ... ok
test [ui] tests/ui/abi/rustcall-generic.rs#normal ... ok
---
test [ui] tests/ui-fulldeps/pprust-parenthesis-insertion.rs ... ok

failures:

---- [ui] tests/ui-fulldeps/rustc-dev-remap.rs#only-remap stdout ----
Saved the actual stderr to `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/rustc-dev-remap.only-remap/rustc-dev-remap.only-remap.stderr`
diff of stderr:

8              ()
9              ControlFlow<T>
10 note: required by a bound in `rustc_ast::visit::Visitor::Result`
-   --> /rustc-dev/xyz/compiler/rustc_ast/src/visit.rs:LL:COL
+   --> $COMPILER_DIR_REAL/rustc_ast/src/visit.rs:LL:COL
+    |
+ LL |     type Result: VisitorResult = ();
+    |                  ^^^^^^^^^^^^^ required by this bound in `Visitor::Result`
12 
13 error: aborting due to 1 previous error
---
To only update this specific test, also pass `--test-args rustc-dev-remap.rs`

error in revision `only-remap`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "/checkout/tests/ui-fulldeps/rustc-dev-remap.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot" "--target=x86_64-unknown-linux-gnu" "--cfg" "only_remap" "--check-cfg" "cfg(test,FALSE,only_remap,remap_unremap)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/rustc-dev-remap.only-remap" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Z" "simulate-remapped-rust-src-base=/rustc-dev/xyz"
stdout: none
--- stderr -------------------------------
error[E0277]: the trait bound `NotAValidResultType: VisitorResult` is not satisfied
##[error]  --> /checkout/tests/ui-fulldeps/rustc-dev-remap.rs:25:19
   |
LL |     type Result = NotAValidResultType;
   |                   ^^^^^^^^^^^^^^^^^^^ the trait `VisitorResult` is not implemented for `NotAValidResultType`
   |
   = help: the following other types implement trait `VisitorResult`:
             ()
             ControlFlow<T>
note: required by a bound in `rustc_ast::visit::Visitor::Result`

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

💔 Test failed - checks-actions

@bors bors 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 Jun 15, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc 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-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.