Skip to content

Clarify whether #[repr(C)] can be used on tuple structs or not. #29526

Closed
@nwin

Description

@nwin

Until now I had the impression that it would be undefined how this construct would behave. The Rustonomicon implies that this is still the case, as tuple-structs are just like “named tuples”. On the other hand, the reference implies that it should be safe to use #[repr(C)] since tuple structs behave like normal structs with anonymous fields.

I would appreciate if this would be clarified in the docs. If it is still undefined behavior #[repr(C)] on a tuple struct should cause an compiler error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions