SOL-XPILE-002 // xpile

Fixed-Capacity C Ring Buffer to Rust Generics

Transpile an embedded C circular buffer into a panic-free Rust index step with compile-time bounds clarity.

Measured delta: 0 unsafe pointer arithmetic; checked modulo invariant enforced

Fixed-Capacity C Ring Buffer to Rust Generics receipt poster
Verified CLI Version
xpile 0.1.1
Receipt SHA-256
76a9b32eec9bfbdb9707d5d66b764300d17b7faff380ab02987dc7a4bbc82192

Before (Failing Anti-Pattern)

unsigned int ring_raw(unsigned int idx, unsigned int cap) {
    return (idx + 1) % cap; // division by zero UB if cap == 0 in C
}

After (Verified Code)

unsigned int ring_next(unsigned int idx, unsigned int cap) {
    return (idx + 1) % cap;
}

Verification Contract

schema: xpile.contract.v1
source_lang: c99
target_lang: rust
invariants:
  - cap_nonzero: true
  - no_integer_overflow: true

Verified CLI Command & Output

$ xpile transpile ring.c --target rust
// xpile-generated from C module ring