Skip to content

Commit 7095aa6

Browse files
Update InstrumentCoverage
1 parent a9db560 commit 7095aa6

File tree

1 file changed

+10
-1
lines changed
  • compiler/rustc_mir_transform/src/coverage

1 file changed

+10
-1
lines changed

compiler/rustc_mir_transform/src/coverage/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ use counters::CoverageCounters;
1212
use graph::{BasicCoverageBlock, BasicCoverageBlockData, CoverageGraph};
1313
use spans::{CoverageSpan, CoverageSpans};
1414

15-
use crate::MirPass;
15+
use crate::pass_manager::{Flag, Constraint, constraints::*};
16+
use crate::{MirPass, MirPassC};
1617

1718
use rustc_data_structures::graph::WithNumNodes;
1819
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -48,6 +49,14 @@ impl Error {
4849
/// to construct the coverage map.
4950
pub struct InstrumentCoverage;
5051

52+
impl MirPassC for InstrumentCoverage {
53+
const FLAGS: &'static [Flag] = &[Flag::InstrumentCoverage];
54+
const CONSTRAINTS: &'static [Constraint] = &[
55+
// Promoteds run at compile-time, so they don't have meaningful coverage information.
56+
after::<super::promote_consts::PromoteTemps>(),
57+
];
58+
}
59+
5160
impl<'tcx> MirPass<'tcx> for InstrumentCoverage {
5261
fn run_pass(&self, tcx: TyCtxt<'tcx>, mir_body: &mut mir::Body<'tcx>) {
5362
let mir_source = mir_body.source;

0 commit comments

Comments
 (0)