Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

unions with only Abi::Scalar fields should get Abi::Scalar themselves #114383

Open
RalfJung opened this issue Aug 2, 2023 · 0 comments
Open

unions with only Abi::Scalar fields should get Abi::Scalar themselves #114383

RalfJung opened this issue Aug 2, 2023 · 0 comments
Labels
A-ABI Area: Concerning the application binary interface (ABI) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented Aug 2, 2023

Consider these types:

union U1 { f: usize }
union U2 { f: *const i32 }
union U3 { f: usize, g: *const i32 }

The first two are getting scalar ABI, but the last one is an aggregate. (As shown by this debug output.)

It seems reasonable to also give the last union Scalar ABI, no? Of course it should be Scalar::Union, but still.

@scottmcm ran into this in #113344.
Cc @eddyb @oli-obk (as usual for layout issues ;)

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 2, 2023
@RalfJung RalfJung changed the title unions with mutliple Abi::Scalar fields should get Abi::Scalar themselves unions with only Abi::Scalar fields should get Abi::Scalar themselves Aug 2, 2023
@Noratrieb Noratrieb added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-ABI Area: Concerning the application binary interface (ABI) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 4, 2023
@workingjubilee workingjubilee added C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such and removed C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such labels Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ABI Area: Concerning the application binary interface (ABI) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants