1
Fork 0

coverage: Avoid ICE when coverage_cx is unexpectedly unavailable

This commit is contained in:
Zalathar 2024-10-31 21:12:15 +11:00
parent 75eff9a574
commit 8dddd1ae60
3 changed files with 12 additions and 2 deletions

View file

@ -554,6 +554,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
/// Extra state that is only available when coverage instrumentation is enabled.
#[inline]
#[track_caller]
pub(crate) fn coverage_cx(&self) -> &coverageinfo::CrateCoverageContext<'ll, 'tcx> {
self.coverage_cx.as_ref().expect("only called when coverage instrumentation is enabled")
}