about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-12-06 11:05:42 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-12-19 16:05:41 +1100
commitdf56c50cee0edad5ecc6e4535d361505407b989a (patch)
tree661d3a2d350aa223c2793be1029345a7f7c3f796 /compiler/rustc_mir_transform/src
parentb9bf0b4b10148aa914243a527d9010aba9b7b827 (diff)
downloadrust-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