Skip to content

Commit 3ff492f

Browse files
committed
coverage: Use DUMMY_SP instead of creating a dummy span manually
This patch also sorts the constructor fields into declaration order.
1 parent dda7d4c commit 3ff492f

File tree

1 file changed

+4
-4
lines changed
  • compiler/rustc_mir_transform/src/coverage

1 file changed

+4
-4
lines changed

compiler/rustc_mir_transform/src/coverage/spans.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::cell::OnceCell;
33
use rustc_data_structures::graph::WithNumNodes;
44
use rustc_index::IndexVec;
55
use rustc_middle::mir::{self, AggregateKind, Rvalue, Statement, StatementKind};
6-
use rustc_span::{BytePos, ExpnKind, MacroKind, Span, Symbol};
6+
use rustc_span::{BytePos, ExpnKind, MacroKind, Span, Symbol, DUMMY_SP};
77

88
use super::graph::{BasicCoverageBlock, CoverageGraph, START_BCB};
99

@@ -271,13 +271,13 @@ impl<'a> CoverageSpansGenerator<'a> {
271271
body_span,
272272
basic_coverage_blocks,
273273
sorted_spans_iter: sorted_spans.into_iter(),
274-
refined_spans: Vec::with_capacity(basic_coverage_blocks.num_nodes() * 2),
275274
some_curr: None,
276-
curr_original_span: Span::with_root_ctxt(BytePos(0), BytePos(0)),
275+
curr_original_span: DUMMY_SP,
277276
some_prev: None,
278-
prev_original_span: Span::with_root_ctxt(BytePos(0), BytePos(0)),
277+
prev_original_span: DUMMY_SP,
279278
prev_expn_span: None,
280279
pending_dups: Vec::new(),
280+
refined_spans: Vec::with_capacity(basic_coverage_blocks.num_nodes() * 2),
281281
};
282282

283283
coverage_spans.to_refined_spans()

0 commit comments

Comments
 (0)