Skip to content

repr(i64) picks 32-bit discriminant on 32-bit platform #26114

Closed
@bluss

Description

@bluss

From the PR #25651 it looks like repr(i64) (and presumably repr(u64)) picks a 32-bit discriminant for the non C-like enum case.

Testcase was:

+#[repr(i64)]
+enum Ei64<T> {
+    _None,
+    _Some(T),
+}
+
+    assert_eq!(size_of::<Ei64<()>>(), 8);

Errored on platform auto-mac-32-opt with this:

thread '<main>' panicked at 'assertion failed:(left == right)(left:4, right:8)', /Users/rustbuild/src/rust-buildbot/slave/auto-mac-32-opt/build/src/test/run-pass/enum-discrim-manual-sizing-2.rs:89

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions