Skip to content

Commit 7899bc3

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 d03ed3d commit 7899bc3

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
@@ -360,11 +360,16 @@ pub enum StatementKind<'tcx> {
360360
/// Disallowed after drop elaboration.
361361
AscribeUserType(Box<(Place<'tcx>, UserTypeProjection)>, ty::Variance),
362362

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

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

0 commit comments

Comments
 (0)