Skip to content

#[repr(X)] should inhibit enum layout optimization #40029

Closed
@bluss

Description

@bluss

This is a regression stable to nightly (breaking nodrop and arrayvec at the moment; not their compilation but their tests, which indicate their implementation is not sound for element types like &T or Vec<T>).

Found by cargobomb report

Note that the regression applies to enums with #[repr(u8)] (and similar) but not #[repr(C)].

PR #25651 was never merged, but it would document this aspect of #[repr(u8)]

Evaluating #39595 for its impact. Thanks @eddyb for the pointers!

Metadata

Metadata

Assignees

Labels

P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions