Skip to content

repr attributes can be applied at module level #64734

Closed
@gnzlbg

Description

@gnzlbg

Spot what's wrong with this code:

#![repr(C)] struct Foo(i32);

extern "C" {
    fn foo(x: Foo);
}

fn main() {}

(Playground)

For some reason, top-level #![repr(..)] attributes are allowed, so Foo isn't repr(C). Sadly,
@rust-lang/underhanded isn't a thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions