magic numbers in token.rs should be static constants #9762
Labels
A-frontend
Area: Compiler frontend (errors, parsing and HIR)
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
There's a large table of special identifiers and (reserved/strict/etc) keywords in
mk_fresh_ident_interners
.There is a note that the indices need to match up with the numbers in
special_idents
.In addition, though, there are uses of the numbers in match arms within the code, and there is evidence that the numbers are not being kept up to date.
Why aren't we at least binding the magic numbers to static constants in a single place (presumably near the table in
mk_fresh_ident_interners
and then referencing those named constants instead?(Or alternatively, we might have the const expressions in the match arms reference the already present static Ident definitions, e.g.
self_.name
... but for that, we would need to supportx.y
as a const expression.)(More elaborate discussion available in IRC log: https://botbot.me/mozilla/rust-internals/msg/6710787/ )
The text was updated successfully, but these errors were encountered: