Skip to content

Introduce compute_abi helper and ComputeCallConv trait - #165920

Open
bjorn3 wants to merge 3 commits into
rust-lang:mainfrom
bjorn3:callconv_refactor
Open

bjorn3 wants to merge 3 commits into
rust-lang:mainfrom
bjorn3:callconv_refactor

Conversation

@bjorn3

@bjorn3 bjorn3 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

View all comments

This deduplicates code between most callconv computation implementations. 32bit x86 has some postprocessing going on that makes it non-trivial to use this abstraction, but for all other archs it works fine.

After that deduplicate ZST arg/ret handling and make sure Rust ZSTs are always ignored. Previously they incorrectly
got passed by-ref on SPARC.

This will help a bit with #119183 by marking it easier to ensure code like the repr(transparent) handling is done consistently across all targets.

@rustbot

rustbot commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_target/src/callconv/amdgpu.rs

cc @Flakebi

@rustbot rustbot added 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 Nov 13, 2026
@rustbot

rustbot commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

rustbot has assigned @folkertdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 79 candidates
  • Random selection from 20 candidates

Comment thread tests/ui/abi/c-zst.rs Outdated

#[rustc_abi(debug)]
extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi
extern "C" fn pass_zst(_: Czst) {} //~ ERROR: fn_abi

@bjorn3 bjorn3 Nov 13, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was testing a Rust ZST, not a C ZST. I've added a new test for Rust ZSTs.

View changes since the review

@bjorn3

bjorn3 commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Aside from the SPARC bugfix no behavior changes are intended.

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@beetrees beetrees left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. Just a few small things.

r? me

View changes since this review

@rustbot rustbot assigned beetrees and unassigned folkertdev Nov 17, 2026
@rustbot rustbot 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 Nov 17, 2026
@folkertdev

Copy link
Copy Markdown
Contributor

also I was thinking that we can probably land most of the test changes as an NFC PR?

@folkertdev

Copy link
Copy Markdown
Contributor

idk if you've already reviewed the whole thing that may not be needed at this point, but at least to me it would make reviewing easier, the diff is (by necessity) a total mess.

@beetrees

beetrees commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

I agree it would be good to land the test changes first separately (probably with the fix for SPARC to make this PR a NFC) so that it's easy to see from CI that this refactor doesn't affect the output.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@bjorn3

bjorn3 commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

Split the testing changes and SPARC fix into #166098

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 17, 2026
Actually test ABI for C ZSTs and fix Rust ZST ABI for SPARC

Split out of rust-lang#165920

r? @beetrees
TDecking pushed a commit to TDecking/miri that referenced this pull request Nov 18, 2026
Actually test ABI for C ZSTs and fix Rust ZST ABI for SPARC

Split out of rust-lang/rust#165920

r? @beetrees
@rustbot

rustbot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@bjorn3 bjorn3 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 18, 2026
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Nov 19, 2026
Actually test ABI for C ZSTs and fix Rust ZST ABI for SPARC

Split out of rust-lang/rust#165920

r? @beetrees
@rust-log-analyzer

This comment was marked as outdated.

@bjorn3

This comment was marked as resolved.

@workingjubilee

Copy link
Copy Markdown
Member

Thanks!

@beetrees beetrees left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit fe548f4 has been approved by beetrees

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 Nov 23, 2026
@beetrees

Copy link
Copy Markdown
Contributor

@bors r-

Could you squash the review changes first? Then r=me.

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

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@rust-bors rust-bors Bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 23, 2026
This deduplicates code between most callconv computation
implementations. 32bit x86 has some postprocessing going on that makes
it non-trivial to use this abstraction, but for all other archs it works
fine.
And make sure Rust ZSTs are always ignored. Previously they incorrectly
got passed by-ref on SPARC.
ExternAbi distinguishes between ABIs that should have identical
callconvs.
@bjorn3

bjorn3 commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Squashed review changes and checked that the diff is unchanged.

@bors r=beetrees

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c4c1ae8 has been tentatively approved by beetrees

It will be put into the queue for this repository once PR CI succeeds.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
Introduce compute_abi helper and ComputeCallConv trait

This deduplicates code between most callconv computation implementations. 32bit x86 has some postprocessing going on that makes it non-trivial to use this abstraction, but for all other archs it works fine.

After that deduplicate ZST arg/ret handling and make sure Rust ZSTs are always ignored. Previously they incorrectly
got passed by-ref on SPARC.

This will help a bit with rust-lang#119183 by marking it easier to ensure code like the `repr(transparent)` handling is done consistently across all targets.

This branch has not been deployed

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

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants