Skip to content

Commit 73ff743

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 f70779b commit 73ff743

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

@@ -272,13 +272,13 @@ impl<'a> CoverageSpansGenerator<'a> {
272272
body_span,
273273
basic_coverage_blocks,
274274
sorted_spans_iter: sorted_spans.into_iter(),
275-
refined_spans: Vec::with_capacity(basic_coverage_blocks.num_nodes() * 2),
276275
some_curr: None,
277-
curr_original_span: Span::with_root_ctxt(BytePos(0), BytePos(0)),
276+
curr_original_span: DUMMY_SP,
278277
some_prev: None,
279-
prev_original_span: Span::with_root_ctxt(BytePos(0), BytePos(0)),
278+
prev_original_span: DUMMY_SP,
280279
prev_expn_span: None,
281280
pending_dups: Vec::new(),
281+
refined_spans: Vec::with_capacity(basic_coverage_blocks.num_nodes() * 2),
282282
};
283283

284284
coverage_spans.to_refined_spans()

0 commit comments

Comments
 (0)