Skip to content

Move decimal-byte-parts kernel logic out of dispatch macros - #11528

Merged
joseph-isaacs merged 2 commits into
developfrom
ji/mutants-macros-decimal-byte-parts
Nov 17, 2026
Merged

joseph-isaacs merged 2 commits into
developfrom
ji/mutants-macros-decimal-byte-parts

Conversation

@joseph-isaacs

@joseph-isaacs joseph-isaacs commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

cargo-mutants can't mutate code inside macros, so logic in decimal-byte-parts' match_each_*! bodies was never mutation tested. This moves the wide-decimal assembly and the decimal-to-primitive overflow check into generic assemble_wide_decimal_array and native_decimal_to_primitive.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UeniBAvrcuvbZMgsM2XrTM

cargo-mutants does not mutate code inside macro invocations, so logic
written in a match_each_* macro body is never mutation tested. Keep the
macro calls as thin type dispatch and move the logic into generic
functions that cargo-mutants can mutate:

- assemble: the match on the number of lower parts, which picks the
  i128/i256 storage width and zips the u64 parts into rows, moves from
  the match_each_signed_integer_ptype! body into
  assemble_wide_decimal_array.
- compare: the narrowing conversion of a decimal value to the MSP type,
  with its overflow direction checks, moves from the
  match_each_decimal_value! body into native_decimal_to_primitive.

Behavior is unchanged and the helpers monomorphize as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UeniBAvrcuvbZMgsM2XrTM
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
@joseph-isaacs
joseph-isaacs enabled auto-merge (squash) November 17, 2026 13:27
@joseph-isaacs joseph-isaacs added the changelog/chore A trivial change label Nov 17, 2026 — with Claude

Copy link
Copy Markdown
Contributor Author

CI status: the failing "Integration smoke tests" job fails on develop too, so it doesn't come from this PR. wasm-test/ has no lockfile and picked up fastlanes 0.8.1, which now requires a 'static bound in rle_decompress.rs (E0310). Fixed in #11543. I'll merge develop into this branch once that lands.


Generated by Claude Code

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
@joseph-isaacs
joseph-isaacs merged commit 4c3c318 into develop Nov 17, 2026
80 checks passed
@joseph-isaacs
joseph-isaacs deleted the ji/mutants-macros-decimal-byte-parts branch November 17, 2026 14:15
connortsui20 added a commit that referenced this pull request Nov 18, 2026
`cargo-mutants` skips macro bodies, so it cannot mutate predicates and
loops inside type dispatch. Generic helpers make that logic available to
mutation testing and preserve static dispatch.

This follows the approach in #11528 and #11532.

This change was prepared with assistance from Codex.

---------

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants