diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-12-06 11:05:42 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-12-19 16:05:41 +1100 |
| commit | df56c50cee0edad5ecc6e4535d361505407b989a (patch) | |
| tree | 661d3a2d350aa223c2793be1029345a7f7c3f796 /compiler/rustc_mir_transform/src | |
| parent | b9bf0b4b10148aa914243a527d9010aba9b7b827 (diff) | |
| download | rust-df56c50cee0edad5ecc6e4535d361505407b989a.tar.gz rust-df56c50cee0edad5ecc6e4535d361505407b989a.zip | |
Make `TokenType::from_u32` foolproof.
Currently it relies on having the right integer for every variant, and if you add a variant you need to adjust the integers for all subsequent variants, which is a pain. This commit introduces a match guard formulation that takes advantage of the enum-to-integer conversion to avoid specifying the integer for each variant. And it does this via a macro to avoid lots of boilerplate.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
0 files changed, 0 insertions, 0 deletions
