Files
rust/compiler/rustc_mir_dataflow
Matthias Krüger 02f733bb48 Rollup merge of #156169 - nnethercote:simplify-SwitchInt-stuff, r=cjgillot
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
2026-05-10 03:17:00 +02:00
..