Repository navigation
Mutation-coverage patch. No API changes, no behaviour changes. Adds tests
that close the remaining tractable gaps in the pre-0.14.0 code, and
introduces a durable convention for documenting mutants that are provably
equivalent-by-construction so future sweeps can stop chasing them.
Test coverage
Flags::contains— added three per-flagother=set, self=emptycases
(one each for N, Z, C), which pin the!other.x || self.xclauses that
the existingNZC.contains(ALL)case only exercised for V. Kills three
delete !mutants insrc/flags.rs:121.encode_stm_ldmT1 (stmia/ldmianarrow encoder insrc/isa/t16_branch.rs)
— added a hand-built-Insncase withRninr8..=r15for both
mnemonics. Ther.is_low()guard on the base register was previously
only exercised by the exhaustive-halfword round-trip loop, whose inputs
never see a non-low base; a mutant that replaced the guard withtrue
would silently flipstmia(base0xC000) toldmia(base0xC800)
throughrn << 8overflow. The new test assertsencodereturnsNone
for every non-low base for both mnemonics.
Documentation
Introduces a // mutant-equivalent: line-marker convention for mutants
that are provably equivalent-by-construction — the mutation produces the
same observable behaviour as the original across every input the function
can receive, so no test can distinguish them. Comments are one line,
positioned on or immediately above the mutated line, and state the
equivalence argument in one sentence.
Sites documented in this release:
src/isa/mod.rs:317,:331— the two 32-bit dispatch arms whose
mutation is subsumed by the_ =>catch-all'st32_coproc::decode(...) .or_else(t32_simd::decode), or by that catch-all'sNone. The existing
block comments already argued the equivalence; themutant-equivalent
markers make them greppable.src/lib.rs:904—Asm::imm'sstep > 1fast-path: withstep == 1,
v % 1is identically0, so the second conjunct is unreachable under
either> 1or>= 1.src/analysis.rs:687—reachable_with'simage[at + 1]for
it_state_fromreads only the low byte's cond/mask nibbles; the high
byte the second index would name (the IT opcode's0xBF) is never
looked at, soat + 1→at * 1is observably identical.src/isa/t32_coproc.rs:1464..1472— the pre-existing block comment on
the four hand-writtenr.num() < 16guards has grown a
mutant-equivalent (nine mutants — ...)header so the grep sweep
recognises the whole family in one place.Reg::numisself.0 & 0xF,
so the predicate is unconditionally true and every weakening of it
yields an identical program.
Not addressed
The 597 replace | with ^ misses on encoders that OR together
mask-disjoint bit-fields remain provably equivalent-by-construction, as
cargo-mutants' own runbook (skill §7b) calls out. The hw = a | b | c
family is left as-is: annotating each one line-by-line would be six
hundred lines of noise. A future release may add a per-encoder-file
header once the semantics of "these fields are disjoint" is stated once
in isa::insn and pointed to from the emitters.