Skip to content

#[repr(align="")] has terrible diagnostics #50314

Description

@nagisa

The attribute was fairly recently stabilised in form of #[repr(align(x))] however the RFC and some searches still refer to the attribute as #[repr(align="x")], in which case the compiler emits the following error:

error[E0552]: unrecognized representation hint
   --> libcore/../libcore/tests/slice.rs:574:12
    |
574 |     #[repr(align=8)] struct U64(u64, u64);
    |            ^^^^^^^

We should detect this case and inform users of the correct way to specify the alignment.

cc #33626

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions