Skip to content
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

Reserved Keyword Collision #8

Closed
PokeJofeJr4th opened this issue Jul 1, 2023 · 0 comments
Closed

Reserved Keyword Collision #8

PokeJofeJr4th opened this issue Jul 1, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@PokeJofeJr4th
Copy link
Owner

#[derive(EnumMap)]
enum Keyword {
    Const,
}

This piece of code fails with the following error message:

error: expected identifier, found keyword `const`
  --> strum_tests\tests\enum_map.rs:15:10
   |
15 | #[derive(EnumMap)]
   |          ^^^^^^^ expected identifier, found keyword
16 | enum Keyword {
   |      ------- while parsing this struct
   |
   = note: this error originates in the derive macro `EnumMap` (in Nightly builds, run with -Z macro-backtrace for more info)
help: escape `const` to use it as an identifier
   |
15 | #[derive(r#EnumMap)]
   |          ++

From this message, one could understand that the problem is the Const variant, but the EnumMap macro should probably either escape the identifier or return a clearer error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant