Skip to content

Commit a55ab56

Browse files
committed
coverage: Remove redundant field prev_expn_span
This span can always be retrieved from `prev`, so there is no need to store it separately.
1 parent 7ec70db commit a55ab56

File tree

1 file changed

+2
-7
lines changed
  • compiler/rustc_mir_transform/src/coverage

1 file changed

+2
-7
lines changed

compiler/rustc_mir_transform/src/coverage/spans.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ struct CoverageSpansGenerator<'a> {
214214
/// is mutated.
215215
prev_original_span: Span,
216216

217-
/// A copy of the expn_span from the prior iteration.
218-
prev_expn_span: Option<Span>,
219-
220217
/// One or more `CoverageSpan`s with the same `Span` but different `BasicCoverageBlock`s, and
221218
/// no `BasicCoverageBlock` in this list dominates another `BasicCoverageBlock` in the list.
222219
/// If a new `curr` span also fits this criteria (compared to an existing list of
@@ -275,7 +272,6 @@ impl<'a> CoverageSpansGenerator<'a> {
275272
curr_original_span: DUMMY_SP,
276273
some_prev: None,
277274
prev_original_span: DUMMY_SP,
278-
prev_expn_span: None,
279275
pending_dups: Vec::new(),
280276
refined_spans: Vec::with_capacity(basic_coverage_blocks.num_nodes() * 2),
281277
};
@@ -394,8 +390,8 @@ impl<'a> CoverageSpansGenerator<'a> {
394390

395391
fn check_invoked_macro_name_span(&mut self) {
396392
let Some(visible_macro) = self.curr().visible_macro(self.body_span) else { return };
397-
if let Some(prev_expn_span) = &self.prev_expn_span
398-
&& prev_expn_span.ctxt() == self.curr().expn_span.ctxt()
393+
if let Some(prev) = &self.some_prev
394+
&& prev.expn_span.ctxt() == self.curr().expn_span.ctxt()
399395
{
400396
return;
401397
}
@@ -472,7 +468,6 @@ impl<'a> CoverageSpansGenerator<'a> {
472468
/// Advance `prev` to `curr` (if any), and `curr` to the next `CoverageSpan` in sorted order.
473469
fn next_coverage_span(&mut self) -> bool {
474470
if let Some(curr) = self.some_curr.take() {
475-
self.prev_expn_span = Some(curr.expn_span);
476471
self.some_prev = Some(curr);
477472
self.prev_original_span = self.curr_original_span;
478473
}

0 commit comments

Comments
 (0)