mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 13:05:18 +03:00
02f733bb48
Change `SwitchInt` handling in dataflow analysis. We call `get_switch_int_data` once for the switch and then pass that data to `apply_switch_int_edge_effect` for each switch target. The only case in practice is `MaybePlacesSwitchIntData` which does an awkward thing, maintaining an index into the discriminants and updating it on each call to `apply_switch_int_edge_effect`. This commit changes things to do more work up front in `get_switch_int_data`, in order to then do less work in `apply_switch_int_edge_effect`. This avoids the need for the `variants` and `next_discr` methods and the discriminants index. Overall it's a little simpler. r? @cjgillot