@@ -20,6 +20,14 @@ pub struct BasicBlocks<'tcx> {
2020// Typically 95%+ of basic blocks have 4 or fewer predecessors.
2121type Predecessors = IndexVec < BasicBlock , SmallVec < [ BasicBlock ; 4 ] > > ;
2222
23+ /// Each `(target, switch)` entry in the map contains a list of switch values
24+ /// that lead to a `target` block from a `switch` block. The list always(?)
25+ /// has length 1.
26+ ///
27+ /// Note: this type is currently never instantiated, because it's only used for
28+ /// `BasicBlocks::switch_sources`, which is only called by backwards analyses
29+ /// that do `SwitchInt` handling, and we don't have any of those, not even in
30+ /// tests. See #95120 and #94576.
2331type SwitchSources = FxHashMap < ( BasicBlock , BasicBlock ) , SmallVec < [ Option < u128 > ; 1 ] > > ;
2432
2533#[ derive( Clone , Default , Debug ) ]
@@ -70,8 +78,8 @@ impl<'tcx> BasicBlocks<'tcx> {
7078 } )
7179 }
7280
73- /// `switch_sources()[&(target, switch)]` returns a list of switch
74- /// values that lead to a `target` block from a `switch` block .
81+ /// Returns info about switch values that lead from one block to another
82+ /// block. See `SwitchSources` .
7583 #[ inline]
7684 pub fn switch_sources ( & self ) -> & SwitchSources {
7785 self . cache . switch_sources . get_or_init ( || {
0 commit comments