Skip to content

Commit 753caf2

Browse files
committed
coverage: Update docs for StatementKind::Coverage
This new description reflects the changes made in this PR, and should hopefully be more useful to non-coverage developers who need to care about coverage statements.
1 parent 13b2d60 commit 753caf2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

compiler/rustc_middle/src/mir/syntax.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,16 @@ pub enum StatementKind<'tcx> {
361361
/// Disallowed after drop elaboration.
362362
AscribeUserType(Box<(Place<'tcx>, UserTypeProjection)>, ty::Variance),
363363

364-
/// Marks the start of a "coverage region", injected with '-Cinstrument-coverage'. A
365-
/// `Coverage` statement carries metadata about the coverage region, used to inject a coverage
366-
/// map into the binary. If `Coverage::kind` is a `Counter`, the statement also generates
367-
/// executable code, to increment a counter variable at runtime, each time the code region is
368-
/// executed.
364+
/// Carries control-flow-sensitive information injected by `-Cinstrument-coverage`,
365+
/// such as where to generate physical coverage-counter-increments during codegen.
366+
///
367+
/// Coverage statements are used in conjunction with the coverage mappings and other
368+
/// information stored in the function's
369+
/// [`mir::Body::function_coverage_info`](crate::mir::Body::function_coverage_info).
370+
/// (For inlined MIR, take care to look up the *original function's* coverage info.)
371+
///
372+
/// Interpreters and codegen backends that don't support coverage instrumentation
373+
/// can usually treat this as a no-op.
369374
Coverage(Box<Coverage>),
370375

371376
/// Denotes a call to an intrinsic that does not require an unwind path and always returns.

0 commit comments

Comments
 (0)