coverage: Pull function source hash out of map_data.rs

This commit is contained in:
Zalathar
2024-12-14 23:14:19 +11:00
parent 527f8127bb
commit d34c365eb0
3 changed files with 7 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
use rustc_middle::mir::coverage::{CoverageIdsInfo, FunctionCoverageInfo};
pub(crate) struct FunctionCoverage<'tcx> {
#[expect(unused)] // This whole file gets deleted later in the same PR.
pub(crate) function_coverage_info: &'tcx FunctionCoverageInfo,
/// If `None`, the corresponding function is unused.
ids_info: Option<&'tcx CoverageIdsInfo>,
@@ -22,10 +23,4 @@ impl<'tcx> FunctionCoverage<'tcx> {
pub(crate) fn is_used(&self) -> bool {
self.ids_info.is_some()
}
/// Return the source hash, generated from the HIR node structure, and used to indicate whether
/// or not the source code structure changed between different compilations.
pub(crate) fn source_hash(&self) -> u64 {
if self.is_used() { self.function_coverage_info.function_source_hash } else { 0 }
}
}