Skip to content

Commit 06bc597

Browse files
author
zhuyunxing
committed
(>6e70bea)move DecisionId into coverageinfo/mcdc.rs
1 parent e68968e commit 06bc597

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

compiler/rustc_middle/src/mir/coverage.rs

-10
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,6 @@ rustc_index::newtype_index! {
5050
#[debug_format = "ExpressionId({})"]
5151
pub struct ExpressionId {}
5252
}
53-
54-
rustc_index::newtype_index! {
55-
/// ID of a mcdc decision. Used to identify decision in a function.
56-
#[derive(HashStable)]
57-
#[encodable]
58-
#[orderable]
59-
#[debug_format = "DecisionId({})"]
60-
pub struct DecisionId {}
61-
}
62-
6353
rustc_index::newtype_index! {
6454
/// ID of a mcdc condition. Used by llvm to check mcdc coverage.
6555
///

compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::rc::Rc;
55
use rustc_data_structures::fx::FxIndexMap;
66
use rustc_middle::bug;
77
use rustc_middle::mir::coverage::{
8-
BlockMarkerId, ConditionId, ConditionInfo, DecisionId, MCDCBranchSpan, MCDCDecisionSpan,
8+
BlockMarkerId, ConditionId, ConditionInfo, MCDCBranchSpan, MCDCDecisionSpan,
99
};
1010
use rustc_middle::mir::BasicBlock;
1111
use rustc_middle::thir::{ExprKind, LogicalOp};
@@ -24,6 +24,9 @@ const MAX_CONDITIONS_IN_DECISION: usize = 6;
2424
/// consuming excessive memory.
2525
const MAX_DECISION_DEPTH: u16 = 0x3FFF;
2626

27+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
28+
struct DecisionId(usize);
29+
2730
#[derive(Debug)]
2831
struct BooleanDecisionCtx {
2932
id: DecisionId,
@@ -253,7 +256,7 @@ impl MCDCTargetInfo {
253256
struct DecisionIdGen(usize);
254257
impl DecisionIdGen {
255258
fn next_decision_id(&mut self) -> DecisionId {
256-
let id = DecisionId::from_usize(self.0);
259+
let id = DecisionId(self.0);
257260
self.0 += 1;
258261
id
259262
}

0 commit comments

Comments
 (0)