Skip to content

Continue performing Data Oriented Design optimization in enums with variants of similar size #106026

@SUPERCILEX

Description

@SUPERCILEX

Original discussion: https://internals.rust-lang.org/t/automated-data-oriented-design-dod-transformations/18011

Problem:

enum E {
    A(u64, u32, u16, u8, bool),
    B(u64),
}

If you add anything to variat B, the size of the enum jumps from 16 bytes to 24, even though the tag byte should continue to be able to be shared with the bool. It's possible that this is intentional, but we couldn't figure out conclusively why in IRLO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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