Skip to content

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

Open

Description

@RalfJung

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 ;)

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 2, 2023
  2. 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[/+] on Aug 2, 2023
  3. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-ABIArea: Concerning the application binary interface (ABI)
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 4, 2023
  4. added
    C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing such
    and removed
    C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing such
    on Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ABIArea: Concerning the application binary interface (ABI)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions