Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DutchGhost opened this issue Jan 4, 2021 · 3 comments · Fixed by #80714
Closed

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

DutchGhost opened this issue Jan 4, 2021 · 3 comments · Fixed by #80714
Labels
A-const-generics Area: const generics (parameters and arguments) A-diagnostics Area: Messages for errors, warnings, and lints B-unstable Blocker: Implemented in the nightly compiler and unstable. C-bug Category: This is a bug. D-papercut Diagnostics: An error or lint that needs small tweaks. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DutchGhost
Copy link
Contributor

DutchGhost commented Jan 4, 2021

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

@DutchGhost DutchGhost changed the title Invalid feature suggesting Invalid feature suggestion: #[feature(const_generics)] Jan 4, 2021
@oli-obk oli-obk added A-const-generics Area: const generics (parameters and arguments) A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. B-unstable Blocker: Implemented in the nightly compiler and unstable. labels Jan 4, 2021
@tesuji
Copy link
Contributor

tesuji commented Jan 5, 2021

One just need to change this line:

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

then bless respective stderr files.

@varkor
Copy link
Member

varkor commented Jan 5, 2021

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.

@JohnTitor JohnTitor added C-bug Category: This is a bug. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 5, 2021
@jakevossen5
Copy link
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
Labels
A-const-generics Area: const generics (parameters and arguments) A-diagnostics Area: Messages for errors, warnings, and lints B-unstable Blocker: Implemented in the nightly compiler and unstable. C-bug Category: This is a bug. D-papercut Diagnostics: An error or lint that needs small tweaks. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants