Skip to content

Large enum variant: print size of all other variants? #9009

Open
@xmo-odoo

Description

@xmo-odoo

Description

For enums where all variants are quite large, the lint seems pretty misfirey e.g. I've an enum where the largest member is 7200 bytes, but the second largest is 6800, and the third is probably 6500.

The lint currently only prints the first and second, which is less informative than it could be.

An other option would be to suggest boxing the entire enum if many / most variants are very large, even if it triggers very large allocation for a small number of small variants it seems like it'd not be much of an issue. Maybe that could be part of a "large struct" lint if there is one?

Version

rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-unknown-linux-gnu
release: 1.61.0
LLVM version: 14.0.0

Additional Labels

@rustbot label +C-question

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions