Unbox and unwrap the contents of StatementKind::Coverage

The payload of coverage statements was historically a structure with several
fields, so it was boxed to avoid bloating `StatementKind`.

Now that the payload is a single relatively-small enum, we can replace
`Box<Coverage>` with just `CoverageKind`.

This patch also adds a size assertion for `StatementKind`, to avoid
accidentally bloating it in the future.
This commit is contained in:
Zalathar
2024-03-23 19:13:52 +11:00
parent c3b05c6e5b
commit ab92699f4a
15 changed files with 44 additions and 68 deletions

View File

@@ -1,5 +1,5 @@
use super::BackendTypes;
use rustc_middle::mir::Coverage;
use rustc_middle::mir::coverage::CoverageKind;
use rustc_middle::ty::Instance;
pub trait CoverageInfoBuilderMethods<'tcx>: BackendTypes {
@@ -7,5 +7,5 @@ pub trait CoverageInfoBuilderMethods<'tcx>: BackendTypes {
///
/// This can potentially be a no-op in backends that don't support
/// coverage instrumentation.
fn add_coverage(&mut self, instance: Instance<'tcx>, coverage: &Coverage);
fn add_coverage(&mut self, instance: Instance<'tcx>, kind: &CoverageKind);
}