From 05f5f2e3918c421877099deaab10e7771ceef4f5 Mon Sep 17 00:00:00 2001 From: "Martin Kolinek (from Dev Box)" Date: Fri, 12 Jun 2026 19:06:23 +0200 Subject: [PATCH] fix(multitude): restore coverage for transcode_utf16_into PR #478 (feat(thread_aware): add feature-gated ThreadAware impls for 3rd-party crate types) dropped codecov from 100% to 99.9% even though it didn't touch multitude. The 11 missed lines are the body of the private `transcode_utf16_into` helper in `crates/multitude/src/arena/alloc_utf16.rs`. Root cause: the helper is `#[inline(always)]`, so no out-of-line copy exists in the test binary. llvm-cov has to attribute hits to inlined copies via debuginfo, and that mapping is fragile -- it shifted when PR #478 added new optional deps (`bytes`, `http`, `jiff02`, `uuid`) to `thread_aware`, which is a transitive dep of multitude via bytesbuf. Fix: gate the `inline(always)` on `not(coverage_nightly)` so under coverage instrumentation the function keeps a real callable body that llvm-cov attributes hits to deterministically. Release/dev/CI test builds keep `inline(always)` exactly as today -- zero perf change for users. Verified locally with `cargo +nightly-2026-05-30 llvm-cov --all-features -p multitude --lcov`: before the change, alloc_utf16.rs reports 72 hit / 11 missed (exactly lines 213, 219-225, 227, 228, 230); after the change, 83 hit / 0 missed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/multitude/src/arena/alloc_utf16.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/multitude/src/arena/alloc_utf16.rs b/crates/multitude/src/arena/alloc_utf16.rs index 442a9171f..a596026e5 100644 --- a/crates/multitude/src/arena/alloc_utf16.rs +++ b/crates/multitude/src/arena/alloc_utf16.rs @@ -205,7 +205,13 @@ impl Arena { /// via `encode_utf16` into the `u16` payload immediately after, and /// returns a thin pointer to the first payload element. `exact` must /// match `s.chars().map(char::len_utf16).sum()` from a pre-walk. -#[inline(always)] +// +// Skip `inline(always)` under coverage instrumentation so a real +// out-of-line function body exists for llvm-cov to attribute hits to. +// With `inline(always)` the source-line mapping for the inlined copies +// is fragile and shifts with the dep graph (observed: 11 lines went +// from 100% to missed when PR #478 added optional deps elsewhere). +#[cfg_attr(not(coverage_nightly), inline(always))] #[allow( clippy::cast_ptr_alignment, reason = "see callers: `base + PREFIX_BYTES` is u16-aligned by construction"