@@ -20,6 +20,14 @@ pub struct BasicBlocks<'tcx> {
20
20
// Typically 95%+ of basic blocks have 4 or fewer predecessors.
21
21
type Predecessors = IndexVec < BasicBlock , SmallVec < [ BasicBlock ; 4 ] > > ;
22
22
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.
23
31
type SwitchSources = FxHashMap < ( BasicBlock , BasicBlock ) , SmallVec < [ Option < u128 > ; 1 ] > > ;
24
32
25
33
#[ derive( Clone , Default , Debug ) ]
@@ -70,8 +78,8 @@ impl<'tcx> BasicBlocks<'tcx> {
70
78
} )
71
79
}
72
80
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` .
75
83
#[ inline]
76
84
pub fn switch_sources ( & self ) -> & SwitchSources {
77
85
self . cache . switch_sources . get_or_init ( || {
0 commit comments