Skip to content

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

Closed
@DutchGhost

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)]

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