Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #3738 > unrolled thread

From C to Idiomatic Rust: A Ship-of-Theseus Agentic Translation

Started byJohn R Levine <johnl@taugh.com>
First post2026-08-02 22:35 -0400
Last post2026-08-02 22:35 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.compilers


Contents

  From C to Idiomatic Rust: A Ship-of-Theseus Agentic Translation John R Levine <johnl@taugh.com> - 2026-08-02 22:35 -0400

#3738 — From C to Idiomatic Rust: A Ship-of-Theseus Agentic Translation

FromJohn R Levine <johnl@taugh.com>
Date2026-08-02 22:35 -0400
SubjectFrom C to Idiomatic Rust: A Ship-of-Theseus Agentic Translation
Message-ID<26-08-001@comp.compilers>
This paper starts by translating C to bad Rust code, then uses an LLM to
make the Rust code better.

Abstract

C underpins operating systems, embedded platforms, and network
infrastructure because its abstractions map directly to machine behaviour.
Its explicit memory model, predictable data representations, and minimal
runtime allow compilers to generate fast, deterministic code. These
properties also leave correctness and memory safety entirely to the
programmer, making undefined behaviour, pointer misuse, and lifetime
errors persistent sources of defects and security vulnerabilities in
long-lived C codebases. Rust eliminates most of failure modes through a
static ownership and borrowing model that enforces memory safety and
aliasing constraints at compile time. However, mature C systems cannot be
translated directly: implicit layout assumptions, aliasing patterns, and
undefined behaviour must be reconstructed before safe Rust can be
produced.

This paper presents a migration methodology that first generates a
semantics-preserving, non-idiomatic Rust baseline and then incrementally
rewrites it into idiomatic Rust using agentic AI, validating each step
through compilation and behavioural testing. Applied to iodine (12.5k
SLOC), the approach demonstrates that reliable C-to-Rust migration is a
structured transformation workflow rather than a single translation step.

https://arxiv.org/abs/2607.28835

Regards,
John Levine, johnl@taugh.com, Taughannock Networks, Trumansburg NY
Please consider the environment before reading this e-mail. https://jl.ly

[toc] | [standalone]


Back to top | Article view | comp.compilers


csiph-web