Skip to content

Invalid feature suggestion: #[feature(const_generics)] #80702

Closed

Description

@DutchGhost

When writing a const generic that uses a type other than bool, char or integer, the compiler generates the following error message:

error: `std::sync::atomic::Ordering` is forbidden as the type of a const generic parameter
 --> src/lib.rs:5:21
  |
5 | struct Bug<const O: atomic::Ordering>;
  |                     ^^^^^^^^^^^^^^^^
  |
  = note: the only supported types are integers, `bool` and `char`
  = help: more complex types are supported with `#[feature(const_generics)]`

However, this error message is wrong, as its missing a ! in the feature suggestion.
It should be #![feature(const_generics)] rather than #[feature(const_generics)]

Activity

  1. changed the title [-]Invalid feature suggesting[/-] on Jan 4, 2021
  2. added
    A-const-genericsArea: const generics (parameters and arguments)
    A-diagnosticsArea: Messages for errors, warnings, and lints
    D-papercutDiagnostics: An error or lint that needs small tweaks.
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    B-unstableBlocker: Implemented in the nightly compiler and unstable.
    on Jan 4, 2021
  3. tesuji commented on Jan 5, 2021

    @tesuji
    Contributor

    One just need to change this line:

    .help("more complex types are supported with `#[feature(const_generics)]`")

    then bless respective stderr files.

  4. varkor commented on Jan 5, 2021

    @varkor
    Contributor

    then bless respective stderr files.

    One doesn't even need to build the compiler: a search and replace for #[feature(const_generics)] in src/test would be enough.

  5. added
    C-bugCategory: This is a bug.
    E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 5, 2021
  6. jakevossen5 commented on Jan 5, 2021

    @jakevossen5
    Contributor

    I can do this quick if that's okay.

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-const-genericsArea: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsB-unstableBlocker: Implemented in the nightly compiler and unstable.C-bugCategory: This is a bug.D-papercutDiagnostics: An error or lint that needs small tweaks.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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