Skip to content

Commit b6fb293

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 685d1e5 commit b6fb293

File tree

1 file changed

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

1 file changed

+3
-7
lines changed

compiler/rustc_mir_transform/src/coverage/spans.rs

Lines changed: 3 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
};
@@ -395,8 +391,9 @@ impl<'a> CoverageSpansGenerator<'a> {
395391
fn check_invoked_macro_name_span(&mut self) {
396392
let Some(visible_macro) = self.curr().visible_macro(self.body_span) else { return };
397393
if self
398-
.prev_expn_span
399-
.is_some_and(|prev_expn_span| prev_expn_span.ctxt() == self.curr().expn_span.ctxt())
394+
.some_prev
395+
.as_ref()
396+
.is_some_and(|prev| prev.expn_span.ctxt() == self.curr().expn_span.ctxt())
400397
{
401398
return;
402399
}
@@ -473,7 +470,6 @@ impl<'a> CoverageSpansGenerator<'a> {
473470
/// Advance `prev` to `curr` (if any), and `curr` to the next `CoverageSpan` in sorted order.
474471
fn next_coverage_span(&mut self) -> bool {
475472
if let Some(curr) = self.some_curr.take() {
476-
self.prev_expn_span = Some(curr.expn_span);
477473
self.some_prev = Some(curr);
478474
self.prev_original_span = self.curr_original_span;
479475
}

0 commit comments

Comments
 (0)