Skip to content

Enums with only one variant and without #[repr(_)] have size 0 in 1.27 beta #50830

Closed
@pietroalbini

Description

@pietroalbini

Some crates are defining enums with only one variant without using #[repr(_)], and in 1.27 beta those enums have size 0. This breaks those crates when they use transmute though.

An easy fix for those crates is adding the appropriate #[repr()] attribute to the enums, but we might want to revert the change to avoid breaking compatibility.

// Taken from libvirt-rpc in src/request.rs

#[derive(Debug)]
pub enum EventShutdownDetailType 
    Finished = 0,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions