@@ -151,17 +151,26 @@ fn create_mappings<'tcx>(
151
151
} ;
152
152
let region_for_span = |span : Span | make_code_region ( source_map, file_name, span, body_span) ;
153
153
154
+ // Fully destructure the mappings struct to make sure we don't miss any kinds.
155
+ let CoverageSpans {
156
+ code_mappings,
157
+ branch_pairs,
158
+ mcdc_bitmap_bytes : _,
159
+ mcdc_branches,
160
+ mcdc_decisions,
161
+ } = coverage_spans;
154
162
let mut mappings = Vec :: new ( ) ;
155
163
156
- mappings. extend ( coverage_spans. code_mappings . iter ( ) . filter_map (
164
+ mappings. extend ( code_mappings. iter ( ) . filter_map (
165
+ // Ordinary code mappings are the simplest kind.
157
166
|& mappings:: CodeMapping { span, bcb } | {
158
167
let code_region = region_for_span ( span) ?;
159
168
let kind = MappingKind :: Code ( term_for_bcb ( bcb) ) ;
160
169
Some ( Mapping { kind, code_region } )
161
170
} ,
162
171
) ) ;
163
172
164
- mappings. extend ( coverage_spans . branch_pairs . iter ( ) . filter_map (
173
+ mappings. extend ( branch_pairs. iter ( ) . filter_map (
165
174
|& mappings:: BranchPair { span, true_bcb, false_bcb } | {
166
175
let true_term = term_for_bcb ( true_bcb) ;
167
176
let false_term = term_for_bcb ( false_bcb) ;
@@ -171,7 +180,7 @@ fn create_mappings<'tcx>(
171
180
} ,
172
181
) ) ;
173
182
174
- mappings. extend ( coverage_spans . mcdc_branches . iter ( ) . filter_map (
183
+ mappings. extend ( mcdc_branches. iter ( ) . filter_map (
175
184
|& mappings:: MCDCBranch { span, true_bcb, false_bcb, condition_info, decision_depth : _ } | {
176
185
let code_region = region_for_span ( span) ?;
177
186
let true_term = term_for_bcb ( true_bcb) ;
@@ -184,7 +193,7 @@ fn create_mappings<'tcx>(
184
193
} ,
185
194
) ) ;
186
195
187
- mappings. extend ( coverage_spans . mcdc_decisions . iter ( ) . filter_map (
196
+ mappings. extend ( mcdc_decisions. iter ( ) . filter_map (
188
197
|& mappings:: MCDCDecision { span, bitmap_idx, conditions_num, .. } | {
189
198
let code_region = region_for_span ( span) ?;
190
199
let kind = MappingKind :: MCDCDecision ( DecisionInfo { bitmap_idx, conditions_num } ) ;
0 commit comments