Manuscript Offprint
arXiv:2610.34141SpeC2Rust: Specification-Driven Repository-Level C-to-Rust Translation
Junjie Yao
Harbin Institute of Technology
Shenzhen, China
Xiongzheng Guan
Harbin Institute of Technology
Shenzhen, China
Jia Feng
Harbin Institute of Technology
Shenzhen, China
Yujia Chen
Harbin Institute of Technology
Shenzhen, China
Hongliang Tian
Ant Group, China
Cuiyun Gao
Harbin Institute of Technology
Shenzhen, China
Abstract—Legacy C codebases remain central to system software and performance-critical infrastructure, while their weak memory-safety guarantees continue to impose substantial security and maintenance risks. Recent C-to-Rust translation systems, including translators based on large language models (LLMs), have made automated migration increasingly feasible. However, LLM-based translation still faces several challenges. Existing methods often preserve the original C skeleton, making it difficult to recover project intent and module functionalities at repository scale. The translated Rust code may still rely on raw pointers and unsafe constructs. Cross-file interfaces and dependency relations are also difficult to maintain consistently across generated Rust modules. Even when initial translation succeeds, the resulting project still requires costly compilation repair and end-to-end validation, while naively accumulated context during this process can degrade repair stability and efficiency.
To address these challenges, we propose SpeC2Rust, a specification-driven pipeline for repository-level C-to-Rust translation. SpeC2Rust consists of three stages: (1) Project-Intent Structuring, which decomposes the C repository into semantically coherent modules and generates persistent repository-level and module-level specification documents; (2) Spec-Guided Generation, which translates each Rust module against these specifications with a live symbol registry to maintain cross-file consistency instead of collapsing the translated system into poorly structured monolithic Rust files; (3) Layered-Feedback Repair, which organizes repair into targeted batches and injects only failure-relevant diagnostics, specification context, and source evidence to support efficient compilation and test-driven correction.
We evaluate SpeC2Rust on eight repository-level C projects. On eight repository-level C projects, SpeC2Rust generates Rust projects that compile and pass the original end-to-end tests. The generated code contains no raw-pointer declarations, raw-pointer dereferences, or unsafe lines. On the projects shared with the compared LLM-based baseline, SpeC2Rust reduces cost by 66.1% and input-token usage by 84.7%.
Index Terms—C-to-Rust translation, large language models, specification-driven translation, program repair, memory safety
I. INTRODUCTION
Modernizing legacy C code is a long-standing problem in software engineering. C provides weak memory-safety guarantees and a limited type system, which lead to high maintenance cost and frequent security vulnerabilities [1]. By contrast, Rust is increasingly regarded as a practical replacement for C because of its ownership and borrowing mechanisms, together with its strong memory-safety guarantees [2].
Rule-based translation tools such as C2Rust [3] can quickly translate C code into Rust. However, prior studies show that eliminating unsafe code while preserving translation quality remains difficult in practice [4], [5]. In parallel, LLMs have demonstrated strong capability in software engineering tasks, especially code understanding, code generation [6], and program repair [7]. Systems such as C2SaferRust [8] and SmartC2Rust [9] use LLMs to generate safer Rust code, but LLM-based translation still faces several major challenges.
Project-level C-to-Rust migration raises four challenges that are not adequately addressed by existing approaches:
- C Project Intent. LLM-generated Rust code may pass end-to-end tests while still being semantically incomplete or even degenerating into a pseudo implementation. In such cases, the translated result no longer preserves the original algorithmic logic of the C project.
• Memory Safety. Previous approaches often construct a Rust skeleton that closely matches the original C project layout, or directly perform function-level translation over the unsafe Rust generated by C2Rust. As a result, the translated Rust code remains centered around unsafe pointers and blocks, with limited memory-safety guarantees.
• Cross-file Dependencies. Rust projects are organized around modules with explicit dependency relationships. Existing methods sometimes place most or all translated Rust code into a single .rs file. Although this design
Co-first authors.
// Original C decomposition void next() {} void expr(int lev) {} void stmt() {} int main(int argc, char **argv) {}
// Skeleton-preserving Rust output #[no_mangle] pub unsafe extern "C" fn next() {} #[no_mangle] pub unsafe extern "C" fn expr( mut lev: libc::c_longlong) {} #[no_mangle] pub unsafe extern "C" fn stmt() {}
unsafe fn main_0( mut argc: libc::c_longlong, mut argv: *mut *mut libc::c_char, ) -> libc::c_longlong {} pub fn main() {}
// Lexer state remains a global raw pointer #[no_mangle] pub static mut p: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char; #[no_mangle] pub unsafe extern "C" fn next() { loop { tk = *p as libc::c_longlong; p = p.offset(1); ... else if is_alpha(tk) { id.offset(Name) = pp as _; } else if / Conditions / { while / Conditions */ { *data = *p as _; } } } }
#[derive(Clone, Debug, PartialEq, Eq)] pub struct C4 { source: String, position: usize, // Other fields... }
#[derive(Clone, Debug, PartialEq, Eq)] pub struct C4Error { line: usize, message: String, }
impl C4 { pub fn next(&mut self) -> Result<(), C4Error> {} pub fn expr(&mut self, lev:i32) -> Result<(), C4Error> {} pub fn stmt(&mut self) -> Result<(), C4Error> {} fn scan_number(&mut self) -> Result<(), C4Error> {} fn precedence(tok: Token) -> i32 {} // Other func... }
(a) Skeleton-preserving structure
(b) Pointer-centric implementation
(c) SpeC2Rust: Rust-native redesign
Fig. 1: Code comparison from a real C interpreter (c4) in our evaluation dataset. Light red background highlights mark C-centric structure and unsafe carryover in skeleton-preserving translation, while light teal highlights mark the Rust-native abstractions recovered by SpeC2Rust.
avoids dependency management across files, it yields poor code organization and weak maintainability. Moreover, as the size of the C project increases, the translation success rate tends to decrease [10].
• Program Repair. The translated Rust project must be repaired through compilation and testing to ensure behavioral consistency with the original C project. Current methods often feed compiler outputs together with Rust source files back to the LLM, which causes excessive context accumulation and reduces repair effectiveness.
To address these challenges, we present SpeC2Rust, a specification-driven pipeline for repository-level C-to-Rust translation. The main idea of SpeC2Rust is to explicitly externalize repository-level knowledge before code generation, preserve it as reusable specification artifacts, and reinject it on demand during subsequent generation and repair.
During repair, SpeC2Rust organizes compilation diagnostics and test failures into structured repair batches, and uses iterative repair to preserve semantic consistency between the translated Rust project and the original C project. To prevent the repair model from bypassing real failures by directly modifying the tests, dataset test scripts are treated as read-only artifacts throughout repair. To address the four challenges above, SpeC2Rust uses three technical components. First, Project-Intent Structuring partitions the repository into functional modules and generates repository-level and module-level specifications from the recovered project facts. Second, Spec-Guided Generation translates each target module against these specifications and uses a live symbol registry with demand-driven evidence retrieval to maintain cross-file consistency. Third, Layered-Feedback Repair resolves build and test failures through targeted evidence injection, structured repair batching, and read-only test boundaries, thereby improving repair focus and preventing spurious success through test modification.
We evaluate SpeC2Rust on eight GitHub C projects. Across all eight projects, SpeC2Rust produces compilable Rust translations that pass the original end-to-end test scripts and contain no raw-pointer declarations, raw-pointer dereferences, or unsafe lines of code. On the five projects shared with SmartC2Rust, SpeC2Rust reduces monetary cost by 66.1% and input-token usage by 84.7%.
Our contributions are summarized as follows:
• Specification-driven Pipeline for repository-level C-to-Rust translation. We propose SpeC2Rust, a three-stage workflow consisting of Project-Intent Structuring, Spec-Guided Generation, and Layered-Feedback Repair, which externalizes project intent before code generation and reuses it throughout translation and repair.
• Specification-mediated generation and layered repair. SpeC2Rust translates against reusable specification documents rather than raw source fragments alone, and repairs Rust projects through targeted knowledge reinjection with read-only test boundaries, improving safety, cross-file consistency, and repair focus.
• Clearer and safer Rust project reconstruction. By breaking away from rigid C-oriented skeletons, SpeC2Rust produces Rust projects with clearer module organization, more idiomatic abstractions, and higher safety in the final translated repositories.
• Repository-level empirical validation. On eight open-source C projects, SpeC2Rust produces compilable Rust translations that pass the original end-to-end test scripts while eliminating raw-pointer declarations/dereferences and unsafe lines of code. On the five projects shared with SmartC2Rust, it further reduces monetary cost by 66.1% and input-token usage by 84.7%.
Figure 1 illustrates these limitations using code from c4 [15], a small C compiler in our evaluation dataset. Listing 1 shows the Rust project structure produced by a skeleton-based translation strategy. The translated Rust layout remains closely aligned with the original C project and still contains a large amount of unsafe code.
Listings 2 and 3 further compare the internal implementation of the lexer function next() in c4. This function parses the input character stream into tokens consumed by the compiler. In Listing 2, the translated lexer logic is still organized around the global raw pointer p, extern "C" linkage, and pervasive unsafe operations. The generated Rust therefore remains tied to C-style control flow and memory-access patterns. The light-red spans in the figure mark C-derived artifacts that remain in the translated Rust code. [16].
By contrast, Listing 3 shows the Rust code generated by SpeC2Rust. The same functionality is reorganized around a C4 struct and C4Error type. Global state is maintained through struct fields, operations are rewritten as methods over &mut self, and helper functions such as scan_number() improve readability and modularity. Failure cases are exposed through Result-typed interfaces rather than unstructured low-level control flow. This restructuring is closer to the higher-level abstraction strategies observed in human C-to-Rust migration [17]. The light teal spans mark the Rust-native abstractions translated by SpeC2Rust.
This example motivates the central claim of SpeC2Rust: repository-level C-to-Rust translation requires more than local code conversion. Prior work on safer C-to-Rust migration also shows that low-level C representations often need to be lifted into Rust-native abstractions rather than translated syntactically [16], [18]. Such translation requires explicit recovery of project intent, specification-guided generation beyond the source skeleton, and structured repair driven by focused evidence and executable validation.
III. APPROACH
In this section, we propose SpeC2Rust, a specification-driven C-to-Rust translation workflow. As shown in Figure 2, SpeC2Rust comprises three stages: (1) Project-Intent Structuring, which converts whole-project C analysis results into persistent specification documents and structured module plans, (2) Spec-Guided Generation, which uses specification documents to generate the Rust repository in a dependency-aware manner, and (3) Layered-Feedback Repair, which uses compiler diagnostics and test feedback to repair the generated project.
A. Project-Intent Structuring
Stage 1 analyzes the input C repository and produces structured specification documents that encode the project-level design intent, used by the subsequent generation and repair stages. It consists of three steps: Static Analysis, Hierarchical Module Split, and Spec Generation.
-
Static Analysis: We parse each C source and header file with a tree-sitter parser, collecting per-function records (defining file, source span, body, and call sites) and per-file evidence (data definitions, global declarations, macros). We then merge per-file records into a project-level representation, resolving call sites against the function table to build a call graph and linking data-definition evidence with file ownership to form a fact graph. We also serialize all collected evidence as a JSON metadata file so that generation and repair stages can retrieve the original C context without re-parsing.
-
Hierarchical Module Split: We decompose the repository into translation-oriented module units, treating each top-level directory as an initial candidate. We then evaluate each candidate for cohesion using call graph statistics from static analysis. For a candidate module m with intra-module and inter-module call edges, the cohesion score is defined as
Candidates whose score exceeds a threshold are materialized directly as module units. The remaining candidates are refined using three strategies applied in sequence. Struct split groups functions that access the same struct type. Prefix split groups functions sharing a common name prefix (e.g., ast_, ir_gen_), capturing the naming conventions C projects use to delimit logical subsystems. File-local split groups remaining functions by source file. We chunk oversized groups further to stay within LLM context size limits. The output consists of module units for specification generation and cluster units, which are finer-grained slices of module units used as focused context slices during generation and repair. Algorithm 1 summarizes the full procedure.
- Spec Generation: We convert each module unit into a three-document specification bundle. The bundle includes a requirement document covering translation obligations, an implementation plan for Rust-side organization, and a task-decomposition document listing executable translation steps. At the project level, it produces a rewrite context capturing repository structure, subsystem boundaries, public interfaces, and behavioral constraints. It also produces a translation contract defining the expected Rust-side generation boundary. During generation, we retrieve the relevant specification rather than passing raw C source to the model. During repair, the same documents supply source-grounded context for interpreting compiler diagnostics and test failures. Figure 3 shows example produced documents.
B. Spec-Guided Generation
Stage 2 translates the project into Rust by using the Stage 1 specification documents as the primary context. It consists of two steps: Context Assembly and Rust Code Generation.

Fig. 2: Overview of the SpeC2Rust translation pipeline.
Algorithm 1 Hierarchical Module Decomposition
Require: File inventory P, analysis metadata , dependency graph
Ensure: Module units M and cluster units C
1: ;
2:
3:
4: for all do
5:
6:
7:
8: if then
9:
10:
11:
12:
13:
14:
15: else
16:
17: end if
18: end for
19:
20:
21: return
-
Context Assembly: We derive a file-level generation plan from the specification documents, translation contract, and source evidence. The plan specifies each target Rust file's generation order, the C source files it covers, and its dependencies on other planned Rust files. For each file, we assemble a focused context package combining the relevant module specification, the project-level rewrite context, and interface summaries of its dependencies.
-
Rust Code Generation: We generate Rust files in the dependency order defined by the file plan, using the assembled context package as the primary input. When additional

Fig. 3: Example SpeC2Rust specification documents produced during Spec Generation.
evidence is needed, ContextualRustAgent retrieves C source excerpts or previously generated Rust files to supplement the context. When generation reaches the model’s output limit, we append the produced content as a prefix and resume generation, allowing large files to be completed across multiple passes. After generation, we extract the file’s exported function signatures and referenced symbols as an interface summary and register them in a live symbol registry. Subsequent files query the registry to reuse earlier results without rereading the full Rust repository. We then run a lint checker and apply lightweight structural fixes, resolving issues such as duplicate definitions and cross-file reference errors, before advancing to the next file. Figure 4 illustrates the registry format.
C. Layered-Feedback Repair
Stage 3 repairs the generated Rust project using compiler diagnostics and C/Rust behavioral differences, drawing on Stage 1 specifications and Stage 2 interface summaries as repair context. It consists of four steps: execution environment alignment, structural normalization, compilation-Guided Repair, and test-driven repair closure.
Generated Rust symbol registry: visibility policy: xxxxxx
-
src/c4.rs => crate::c4 types: C4 constants: NUM, FUN, xxx fields C4: src_bytes, pos, xxx impl C4: new, next, xxx references:
- pub type C4: path=src/c4.rs
- field C4::src_bytes: Vec<u8>: path=src/c4.rs
- const NUM: path=src/c4.rs
- pub fn C4::main(...) -> i32: path=src/c4.rs
-
src/main.rs functions: main references:
- fn main(): path=src/main.rs
Fig. 4: An example of the generated Rust symbol registry used in Stage 2.
-
Execution Environment Alignment: We construct an aligned execution environment for the C project and the Rust project, recording dependency settings, working directories, input/output conventions, and test commands needed to run both under the same setup. This environment provides the basis for collecting compiler diagnostics and C/Rust behavioral differences used in the subsequent repair steps.
-
Structural Normalization: Before model-based repair, we apply rule-based preprocessing to the generated Rust project to remove structural artifacts that can be resolved without model inference, including formatting errors, invalid module declarations, residual syntax fragments, and import issues. This allows later repair rounds to focus on substantive errors such as type mismatches, ownership violations, and interface mismatches.
-
Compilation-Guided Repair: We run cargo check and cargo build to collect compiler diagnostics and group related diagnostics into repair batches by affected files and dependency relations. For each batch, we build a diagnosis plan identifying the Rust units, module interfaces, and configuration files involved in the failure.
We organize the repair loop into major and minor rounds. Minor rounds iterate over active batches. Major rounds maintain repair memory and trigger rollback when progress stalls. RustRepairAgent repairs each batch using a layered prompt with five components. The repair protocol layer encodes stable repair rules. The failure instance layer describes the current batch using minimized diagnostics and candidate causes. The project knowledge layer provides specifications, module responsibilities, and inter-file dependencies from earlier stages. The evidence retrieval layer supplies Rust code slices, C source excerpts, and execution traces for the current diagnosis. The repair memory layer records the current analysis, attempted repair directions, and edit summaries across rounds. Figure 5 shows this prompt organization. After each patch, we rerun compilation and update the repair memory with the remaining diagnostics and applied edits. If a major round reaches its repair limit without sufficient progress, we
Layered repair prompt (Stage 3)
[Invariant repair protocol] translation objective and repair role read-only test / fixture conventions allowed requests, edit scope, output schema
[Failure instance] active batch or failing script summary minimized compiler diagnostics / test diffs candidate features, files, execution clues
[Persistent project knowledge] specification documents from Stages 1--2 module responsibilities / symbol index reusable project structure and intent
[On-demand evidence injection] Rust line slices for target files C function excerpts or file ranges test artifacts, rerun traces, raw diffs
[Repair memory and validation] current-round summary cross-round handoff summary structured edits + follow-up reads cargo / test rerun + refreshed summary
Fig. 5: Prompt organization in Stage 3 (Layered Equivalence Closure). A concrete script-level repair case is abstracted into layered prompt components: invariant repair protocol, failure-instance context, persistent project knowledge, on-demand evidence, and compact repair memory. This layered knowledge injection keeps the active context focused on the current failure while avoiding uncontrolled prompt growth.
restore the code snapshot from the start of that round and retry.
- Test-Driven Repair Closure: After the Rust project compiles, we run the original test scripts on both the C reference and the Rust program. We compare their execution results, including outputs, exit status, runtime failures, and assertion failures, and convert each behavioral difference into a failure instance. We then construct a compact repair input from minimized test differences, execution traces, and relevant C/Rust code evidence. The repair agent combines this feedback with project knowledge and source evidence to fix behavioral mismatches such as boundary conditions, integer behavior, error paths, and cross-module calls. The loop terminates when the Rust project compiles and passes all end-to-end tests.
IV. EXPERIMENTAL SETUP AND IMPLEMENTATION
- Dataset.: We use C projects from prior work on project-scale C-to-Rust translation, primarily following the evaluation datasets used by prior work [8], [9]. Our dataset contains eight projects: c4 [15], yank [19], sds [20], which [21], cat [22], pwd [23], shc [24], and cflow [25]. Their sizes range from 418 to 49,757 lines of C code. Each project is accompanied by end-to-end shell test scripts. Table I summarizes the dataset composition. LoC, Files, and Functions characterize repository scale and cross-file complexity, which directly affect translation difficulty. #Test Source indicates the provenance of the executable end-to-end test script, clarifying whether the validation artifacts come from prior
TABLE I: Evaluation dataset used in the experimental evaluation.
| Project | LoC | Files | Functions | #Test Source | #Test Cases | #Modules |
|---|---|---|---|---|---|---|
| c4 | 986 | 2 | 4 | SmartC2Rust | 2 | 2 |
| yank | 418 | 1 | 13 | SmartC2Rust | 8 | 1 |
| sds | 1,110 | 4 | 47 | SmartC2Rust | 24 | 1 |
| which | 2,327 | 15 | 24 | SmartC2Rust | 40 | 2 |
| cat | 28,353 | 123 | 134 | C2SaferRust | 4 | 39 |
| pwd | 25,790 | 101 | 129 | C2SaferRust | 2 | 29 |
| shc | 1,253 | 1 | 18 | Source project | 45 | 1 |
| cflow | 49,757 | 146 | 487 | SpeC2Rust | 15 | 120 |
translation work or from the original project itself. #Test Cases reflects the amount of observable semantic behavior covered by each script, which is important for interpreting the strength of semantic-equivalence evaluation. #Modules reports the number of translation modules produced by Stage 1 in SpeC2Rust; this value serves as an indicator of repository decomposition difficulty and shows how much internal structure must be reconstructed before generation and repair.
- Baselines.: We compare SpeC2Rust against four representative baselines:
-
C2Rust [3] is a rule-based open-source toolchain for translating C code (primarily targeting the C99 standard) into Rust.
-
C2SaferRust [8] takes the unsafe Rust code produced by C2Rust, first partitions the code into chunks, and then combines rule-based transformations with LLM-based rewriting to translate unsafe Rust into safer Rust.
-
EvoC2Rust [26] is a skeleton-driven translation tool that first constructs a corresponding Rust skeleton from the input C project and then uses LLM to generate code that fills the skeleton.
-
SmartC2Rust [9] is an iterative, feedback-driven C-to-Rust translation approach via large language models for safety and equivalence, and it serves as our primary comparison point.
- Metrics: Following prior work on C-to-Rust translation [8], [9], [27], we evaluate SpeC2Rust from three perspectives: safety, semantic equivalence, and cost. The same metric abbreviations are used throughout the later RQs.
Safety metrics. We use three safety-related metrics: unsafe lines of code (uLoC), raw-pointer declarations (Decl.), and raw-pointer dereferences (Deref.). These metrics capture how much low-level unsafe behavior remains in the translated Rust project.
Semantic-equivalence metrics. We report compile success (Comp.) and test pass status/rate (Tests Passed). Following prior work, semantic equivalence is assessed by whether the translated Rust project compiles successfully and preserves the observable behavior of the original C project under the original end-to-end test scripts.
Cost metrics. We report the number of model interactions (Chats), input tokens (Input Tokens), output tokens (Output Tokens), end-to-end latency (Time), and total API cost (Cost). These metrics are used to evaluate the practical overhead of repository-level translation and iterative repair.
- Implementation Details.: In all LLM-based experiments, we use the gpt-5.4 API model with max_tokens set to 8192. For evaluation consistency, we place all test scripts under test/ at the root of each C project and copy them into the translated Rust repository after generation. We keep these scripts unchanged and only redirect the executable path from the original C binary to the translated Rust binary. This setup lets us evaluate semantic preservation with the original project tests while avoiding any LLM-driven rewriting of the evaluation scripts.
V. EXPERIMENTAL EVALUATION
We evaluate SpeC2Rust on eight C projects and compare it against representative C-to-Rust translation baselines.
A. Research Questions
This section focuses on the following research questions:
RQ1: How effective is SpeC2Rust at improving translation safety compared with representative C-to-Rust translation baselines?
RQ2: To what extent can SpeC2Rust preserve repository-level semantic equivalence with the original C projects?
RQ3: How cost-efficient is SpeC2Rust compared with prior repository-level C-to-Rust translation approaches?
RQ4: What is the contribution of the major components of SpeC2Rust to the final translation performance?
B. RQ1: Safety
Table II reports the safety results of SpeC2Rust and representative C-to-Rust translation baselines. Across the eight evaluated repositories, SpeC2Rust produces 0 raw-pointer declarations, 0 raw-pointer dereferences, and unsafe code on every project; the aggregate row further shows a reduction in all three safety metrics relative to C2Rust.
Raw-pointer elimination. Across all eight projects, SpeC2Rust produces zero raw-pointer declarations and zero raw-pointer dereferences. In Table II, C2Rust retains between 201 and 6,168 raw-pointer declarations and between 23 and 3,315 raw-pointer dereferences per project, while C2SaferRust still leaves between 91 and 4,994 declarations and between 5 and 2,590 dereferences. On the five projects where SmartC2Rust reports safety outputs, it also reduces raw-pointer declarations and dereferences to zero, but it does not report completed results for cat, shc, or cflow. These results indicate that directly preserving C-oriented structure tends to carry pointer-based interfaces and shared-state patterns into the Rust output, whereas SpeC2Rust systematically removes them at repository scale.
Unsafe-code removal. SpeC2Rust achieves 0%/0 unsafe code on all eight projects. In contrast, C2Rust ranges from 51.29%/2,940 on shc to 91.69%/2,481 on sds, and C2SaferRust still ranges from 9.33%/212 on sds to 89.78%/665 on c4. For SmartC2Rust, four
TABLE II: RQ1 safety comparison. Lower values are better for all safety metrics. Boldface marks the best value in a row, underlining marks tied best values, and “~” indicates that the tool did not produce a successful translation or did not report the corresponding metric.
| Project | LoC | C2Rust | C2SaferRust | SmartC2Rust | EvoC2Rust | SpeC2Rust | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Decl. | Deref. | Unsafe/uLoC | Decl. | Deref. | Unsafe/uLoC | Decl. | Deref. | Unsafe/uLoC | Comp. | Decl. | Deref. | Unsafe/uLoC | ||
| c4 | 502 | 201 | 309 | 89.75%/1,883 | 91 | 307 | 89.78%/665 | 0 | 0 | 0%/0 | ~ | 0 | 0 | 0%/0 |
| yank | 465 | 261 | 23 | 71.13%/1,081 | 148 | 10 | 40.06%/215 | 0 | 0 | 0.04%/1 | ~ | 0 | 0 | 0%/0 |
| sds | 1,943 | 672 | 188 | 91.69%/2,481 | 328 | 106 | 9.33%/212 | 0 | 0 | 0%/0 | ~ | 0 | 0 | 0%/0 |
| which | 3,530 | 428 | 138 | 72.35%/1,982 | 230 | 48 | 16.86%/327 | 0 | 0 | 0%/0 | ~ | 0 | 0 | 0%/0 |
| cat | 28,313 | 1,079 | 311 | 75.40%/7,460 | 719 | 185 | 10.72%/674 | ~ | ~ | ~ | ~ | 0 | 0 | 0%/0 |
| pwd | 25,790 | 1,019 | 286 | 71.70%/5,859 | 650 | 147 | 10.81%/536 | 0 | 0 | 0%/0 | ~ | 0 | 0 | 0%/0 |
| shc | 1,364 | 1,994 | 41 | 51.29%/2,940 | 1,781 | 5 | 9.88%/293 | ~ | ~ | ~ | ~ | 0 | 0 | 0%/0 |
| cflow | 49,757 | 6,168 | 3,315 | 82.56%/35,413 | 4,994 | 2,590 | 14.36%/3,575 | ~ | ~ | ~ | ~ | 0 | 0 | 0%/0 |
| Rel. vs C2Rust | - | - | - | - | ↓24.4% | ↓26.3% | ↓89.0% | N/A | N/A | N/A | N/A | ↓100.0% | ↓100.0% | ↓100.0% |
projects finish at 0%/0, while yank still retains 0.04%/1. The aggregate row further shows that, relative to C2Rust, SpeC2Rust reduces declarations, dereferences, and unsafe lines by 100.0%. This result shows that specification-driven repository reconstruction is more effective than skeleton-preserving translation at removing residual unsafe code.
Answer to RQ1: Compared with C2Rust, SpeC2Rust reduces raw-pointer declarations, raw-pointer dereferences, and unsafe lines of code by 100.0% in the aggregate, while maintaining full translation coverage across the evaluation dataset.
C. RQ2: Semantic Equivalence
Table III summarizes the semantic-equivalence results of SpeC2Rust. Across all eight projects in the evaluation dataset, the translated Rust projects compile successfully and pass the original end-to-end test scripts. In contrast, SmartC2Rust fails to compile on four projects in the current result sheet, and EvoC2Rust does not produce a successful translation for any project in our dataset. C2SaferRust compiles on all projects, because each rewritten function is checked by compilation and testing before replacing its original unsafe counterpart; when the rewritten version fails, the pipeline falls back to the corresponding C2Rust output to preserve buildability. From the perspective of completed repository-level translations, SpeC2Rust is also the only method in the current evaluation that simultaneously provides full eight-project coverage and zero-unsafe outputs. SmartC2Rust reaches 0%/0 unsafe code on four projects and 0.04%/1 on yank, but it does not report completed safety results for cat, shc, or cflow. EvoC2Rust does not produce a compilable translation on any of the eight projects. This coverage difference is important because safety improvements are only meaningful when they are achieved on completed repository translations.
The repair effort varies substantially with project scale. The smallest completed case, c4, requires only four repair iterations, whereas cflow requires 65 iterations. cat is the second most demanding case with 22 iterations. This trend is consistent with the larger code volume and richer cross-file dependencies of these repositories, which create more opportunities for build-level mismatches and test-observable semantic deviations during translation.
TABLE III: RQ2 semantic-equivalence results of SpeC2Rust. Repair Iter. denotes the number of compile-and-test repair iterations after initial Rust generation. Clippy W/E denote the numbers of warnings and errors reported by the final cargo clippy run.
| Project | Repair Iter. | Clippy | Rust LoC | Tests Passed | |
|---|---|---|---|---|---|
| Warning | Error | ||||
| c4 | 4 | 14 | 0 | 992 | ✓ |
| yank | 12 | 10 | 0 | 514 | ✓ |
| sds | 6 | 10 | 0 | 740 | ✓ |
| which | 7 | 11 | 1 | 1,189 | ✓ |
| cat | 22 | 93 | 1 | 3,538 | ✓ |
| pwd | 7 | 30 | 0 | 2,134 | ✓ |
| shc | 9 | 10 | 0 | 895 | ✓ |
| cflow | 65 | 114 | 0 | 11,586 | ✓ |
The final translated code also remains analyzable by standard Rust tooling. Most projects finish with zero cargo clippy errors, while which and cat each retain a single clippy error. The remaining warnings are mainly associated with code paths, helper functions, or interface fragments that are weakly exercised by the available end-to-end tests. Nevertheless, all eight translated projects pass the original end-to-end tests, which is the primary criterion for semantic equivalence in our evaluation.
Answer to RQ2: SpeC2Rust achieves complete end-to-end semantic equivalence on all eight projects in the current dataset, while remaining executable and largely well-formed under the Rust toolchain.
D. RQ3: Cost
We evaluate the overhead of SpeC2Rust from two aspects: (1) performance overhead, including latency, chat count, and token usage, and (2) monetary cost in US dollars. Table IV reports the results for each project. Since SmartC2Rust does not complete cat, shc, or cflow in our evaluation, we use the five projects completed by both tools, i.e., c4, yank,

Fig. 6: Input-token consumption across repair rounds on c4. The legend is placed below the plot for readability.
sds, which, and pwd, for direct comparison. The full eight-project result of SpeC2Rust is also reported to show its total overhead on the complete benchmark.
Performance. On the five common projects, SpeC2Rust requires 254 chats, 1,797.89 K input tokens, 317.28 K output tokens, and 5,908 s in total. In comparison, SmartC2Rust requires 269 chats, 11,723.39 K input tokens, 402.23 K output tokens, and 26,038 s. Thus, SpeC2Rust reduces latency by 77.3%, input-token usage by 84.7%, and output-token usage by 21.1%. The chat count decreases by 5.6%. The reduction is mainly reflected in input tokens and latency, rather than in the number of interactions.
Figure 6 further shows the input-token usage during repair on c4. Both tools require six repair rounds on this trace. However, after the initial round, SpeC2Rust keeps the per-round input size lower than SmartC2Rust. The cumulative input-token usage is 168.58 K for SpeC2Rust, compared with 308.79 K for SmartC2Rust, a 45.4% reduction. This is because SpeC2Rust constructs each repair prompt from the repair protocol, the relevant specification context, and the observed failure evidence. It does not carry forward a growing prompt state across repair rounds.
Cost. On the five common programs, SpeC2Rust costs 38.61. This corresponds to a 66.1% reduction. Since the pricing of LLM calls is mainly determined by input and output tokens, the cost reduction is consistent with the token reduction above. The difference is especially large for input tokens, because SmartC2Rust needs to repeatedly provide large file-level contexts during interactive repair, whereas SpeC2Rust uses specification-guided repair contexts.
Across all eight programs, SpeC2Rust completes every translation. Its total cost is 36.50; 10,626 s) and cat ($11.32; 4,939 s), which also have larger translation and repair workloads.
Overall, SpeC2Rust reduces cost, latency, and token usage on the programs where direct comparison is possible. It also provides completed cost traces for all eight evaluated programs.
Answer to RQ3: On the five projects completed by both tools, SpeC2Rust reduces total cost by 66.1%. It also completes all eight evaluated projects, whereas SmartC2Rust completes five.
E. RQ4: Ablation Study
We conducted an ablation study to understand how the major components of SpeC2Rust contribute to the final translation performance. We evaluate all variants on the eight-project dataset. Our evaluation is based on the following two metrics: (i) compile rate, i.e., the fraction of projects whose translated Rust implementations compile successfully, and (ii) test pass rate, i.e., the average percentage of original end-to-end tests passed by the translated Rust implementations. Table V shows the results. The full system reaches 100.0% on both metrics.
Layered-Feedback Repair. In this study, we omitted RustRepairAgent from SpeC2Rust. Table V shows that the compile rate drops from 100.0% to 25.0%. The test result is N/A because the result sheet does not report a completed end-to-end test outcome for this variant. Without this stage, the system relies on the initial Rust translation and cannot iteratively incorporate compiler diagnostics. As a result, repository-level errors that require cross-file repair or build-level adjustment are difficult to resolve within the translation pipeline.
Project-Intent Structuring. In this study, we omitted the SpecGen Agent. Table V shows that the ablated system still compiles 87.5% of the projects, but the test pass rate drops to 25.0%. This gap indicates that Stage 1 affects semantic correctness more than syntactic validity. In other words, the ablated system can still produce Rust projects that compile in most cases, but the compiled code is less likely to satisfy the original end-to-end tests. Without the specification documents generated by Stage 1, the test agent has less repository-level context during repair and cannot reliably use the intended architecture to complete missing or incorrect functionality.
Hierarchical Decomposition. In this study, we removed hierarchical decomposition from the translation process. Table V shows that the compile rate decreases to 62.5%, and the test pass rate decreases to 12.3%. Compared with the SpecGen Agent ablation, this variant affects both compilation and test behavior more heavily. This result suggests that hierarchical decomposition is important for organizing project context before specification generation and code synthesis. Without it, related files and functions are not to be grouped into coherent translation units, which makes the generated specifications and repair prompts less stable.
Other LLMs beyond GPT. We also ran the full SpeC2Rust pipeline with deepseek-v4-flash. It successfully translated all eight projects and passed all tests,
TABLE IV: RQ3 cost comparison between SpeC2Rust and SmartC2Rust. A dash indicates that SmartC2Rust did not complete the corresponding project successfully, so no directly comparable cost trace is available.
| Project | Cost/$ | Time/s | Chats | Input Tokens/k | Output Tokens/k | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| SpeC | Smart | SpeC | Smart | SpeC | Smart | SpeC | Smart | SpeC | Smart | |
| c4 | 1.13 | 4.41 | 548 | 2,838 | 21 | 28 | 120.02 | 1,092.29 | 32.96 | 35.99 |
| yank | 2.05 | 6.32 | 582 | 2,632 | 25 | 38 | 343.43 | 1,449.77 | 24.99 | 63.62 |
| sds | 1.39 | 7.79 | 768 | 3,158 | 18 | 37 | 158.99 | 2,365.60 | 38.00 | 50.46 |
| which | 2.30 | 11.39 | 905 | 5,058 | 33 | 57 | 357.53 | 3,864.39 | 51.76 | 119.48 |
| pwd | 6.22 | 8.70 | 3,105 | 12,352 | 157 | 109 | 817.92 | 2,951.34 | 169.57 | 132.68 |
| cat | 11.32 | - | 4,939 | - | 222 | - | 188.76 | - | 232.80 | - |
| shc | 2.09 | - | 789 | - | 22 | - | 586.28 | - | 52.93 | - |
| cflow | 36.50 | - | 10,626 | - | 565 | - | 6,220.41 | - | 738.28 | - |
| SpeC2Rust total (8 proj.) | 63.00 | - | 22,262 | - | 1,063 | - | 8,793.34 | - | 1,341.29 | - |
| Overlap total (5 proj.) | 13.09 | 38.61 | 5,908 | 26,038 | 254 | 269 | 1,797.89 | 11,723.39 | 317.28 | 402.23 |
TABLE V: RQ4 ablation results on the eight-project dataset.
| Configuration | Compile Rate | Test Pass Rate |
|---|---|---|
| SpeC2Rust | 100.0% | 100.0% |
| w/o SpecGen Agent | 87.5% | 25.0% |
| w/o Hierarchical Decomposition | 62.5% | 12.3% |
| w/o RustRepairAgent | 25.0% | N/A |
while incurring lower overall cost than our default setting. For this model, we set max_tokens to 32K, because deepseek-v4-flash often emits long reasoning traces and these traces are counted within the output budget. This suggests that the effectiveness of SpeC2Rust is not limited to a single underlying model, although model-specific output-length characteristics should be accounted for when configuring generation budgets.
Answer to RQ4: Removing any component reduces either compile rate or test pass rate. The largest compilation drop occurs without RustRepairAgent, while the largest semantic drop appears when project structuring or decomposition is removed.
VI. DISCUSSION
A. Why SpeC2Rust Works?
We use pwd as a case study to illustrate how SpeC2Rust addresses the C Project Intent challenge through specification-driven generation. In the original C implementation, the function robust_getcwd walks up the directory tree toward the root and compares device and inode numbers at each level to reconstruct the absolute path. This fallback logic is important when the system getcwd fails, for example because of PATH_MAX limits or restricted permissions on parent directories. Figure 7 compares the robust_getcwd translations produced by SmartC2Rust and SpeC2Rust from the same C source.
-
SmartC2Rust: test-passing-oriented translation.: As shown in Figure 7(a), SmartC2Rust replaces the original directory-walking algorithm with a simple env::current_dir() call followed by path normalization. The translated code omits find_dir_entry, inode comparison, and the upward traversal logic. As a result, it passes through a simpler implementation rather than preserving the original algorithmic design. This reflects a broader limitation of feedback-driven repair: the LLM is encouraged to satisfy the available test suite, but not necessarily to retain the intent of the original C implementation.
-
SpeC2Rust: intent-preserving reconstruction.: In contrast, Figure 7(b) shows that SpeC2Rust reconstructs the full directory-walking algorithm. The translation preserves the while-loop that climbs toward the root, uses find_dir_entry to resolve each directory entry by device and inode comparison, and calls file_name_prepend to assemble the path incrementally. It also preserves the original modular organization: the main logic remains in pwd.rs, inode comparison is isolated in same_inode.rs, and xgetcwd is placed in a separate module.
This example highlights the role of SpeC2Rust's Project-Intent Structuring. By explicitly recovering the intended behavior of robust_getcwd—directory ascent plus inode-based name resolution—the system provides generation with stable, reusable specifications rather than relying on tests alone. During Spec-Guided Generation, these specifications guide the LLM toward reconstructing the original algorithmic structure.
The Hierarchical Module Split further strengthens this process by assigning supporting utilities such as same_inode and xgetcwd to separate modules. This allows each module to be generated with focused specification context, reducing interference from unrelated source fragments. Consequently, SpeC2Rust is able to avoid a common failure mode of baseline tools: producing implementations that pass tests but diverge from the original project intent.
B. Threats to Validity
We identify three main threats to the validity of our study.
Internal Validity. A primary threat is the non-deterministic nature of LLM-based translation and repair. Different runs may produce different Rust implementations, repair trajectories, and token costs. To reduce this threat, we run each project multiple times and report averaged results. Another threat fn rust_robust_getcwd() -> Result<String, String> { rust_physical_getcwd().or_else(|| { let cwd = env::current_dir() .map_err(|e| e.to_string())?; let mut normalized = PathBuf::from("/"); for component in cwd.components() { if let Component::Normal(part) = component { normalized.push(part); } } Ok(normalized.to_string_lossy().into_owned()) } }
// NOTE: find_dir_entry, inode comparison, // and directory-walking logic are all lost.
(a) SmartC2Rust: algorithm replaced by env::current_dir() wrapper.
pub fn robust_getcwd(file_name: &mut FileName) -> io::Result<>() { let original = env::current_dir() ?; let root = PathBuf::from("/"); let mut dot_meta = fs::metadata(."); let root_meta = fs::metadata(&root) ?; // Climb toward root, comparing inodes. while !SameInode::same(&dot_meta, &root_meta) { let h = file_name.path.bytes() .filter(|b| *b == b' /').count() + 1; Self::find_dir_entry(&mut dot_meta, file_name, h) ?; } if file_name.path.is_empty() { Self::file_name prepend(file_name, ""); } env::set_current_dir(original) ?; Ok() } // Module structure preserved: pwd.rs, same_inode.rs, xgetcwd.rs.
(b) SpeC2Rust: full algorithm preserved with modular decomposition.
Fig. 7: Comparison of robust_getcwd translation in pwd.
concerns the quality of project knowledge produced in Stage 1. SpeC2Rust relies on Stage 1 to recover module boundaries, interface relations, and behavioral constraints from the input C repository [28], [29]. Errors in this stage can propagate to later generation and repair steps. For example, missing behavioral constraints or incorrect decomposition of tightly coupled functions and data structures may lead to incomplete repair context. The ablation results in RQ4 show that both SpecGen and hierarchical decomposition affect end-to-end correctness [30].
External Validity. Our evaluation covers eight repository-level CLI C projects, but does not include library projects. This scope may limit the generality of our findings to other types of C systems and build configurations. Another possible threat is benchmark contamination. Some evaluated projects may have appeared in the model's pretraining data. However, our task requires repository-level reconstruction, cross-file consistency, compilation repair, and test-based validation, which reduces but does not eliminate this concern.
Construct Validity. We use the original end-to-end test scripts as the main validation criterion. However, passing the original end-to-end tests does not prove full behavioral equivalence, because untested paths may still be incorrect [31]–[33]. Remaining clippy warnings may also reflect weakly exercised helper code, fallback paths, or interface fragments. Future work could combine the current repair loop with fuzzing, differential testing, or specification-level assertions [33]–[36]. For cost, we report token usage and monetary cost under the model pricing used in our experiments. These numbers may change with provider pricing or model updates.
VII. RELATED WORK
Related work most relevant to SpeC2Rust falls into three lines: rule-based and safety-oriented C-to-Rust translation, program-analysis-guided and LLM-based translation, and feedback-driven repair or agent-based code generation.
Rule-based and safety-oriented C-to-Rust translation. Waters [37] provided an early abstraction-oriented view of program migration. In C-to-Rust translation, C2Rust [3] is the canonical rule-based approach: it largely preserves the original C decomposition and offers a practical migration starting point. However, Emre et al. [4] show that preserving semantic equivalence while removing raw pointers and unsafe code remains difficult. Later work pushes safety refinement further, including GenC2Rust [38], C2SaferRust [8], and PR2 [39]. These methods improve safety over direct transpilation, but they still mainly refine C-oriented skeletons rather than reconstructing the repository around explicit Rust-side specifications and module intent.
Program-analysis-guided and LLM-based C-to-Rust translation. Recent work increasingly combines static analysis, prompt engineering, and LLM generation for C-to-Rust translation. Eniser et al. [5] and Pan et al. [40] highlight common weaknesses of LLM-based Rust translation, including compilation failures, inconsistency, and translation-induced bugs. Other approaches add stronger structural guidance, including VERT [41], a static-analysis-driven pipeline [42], C2RustXW [27], RustMap [43], SpecTra [44], and scalable whole-project translation with LLMs [10]. In the C-to-Rust setting, EvoC2Rust [26] shows that skeleton-guided generation can improve structural consistency over direct prompting. However, most existing approaches still use structure, analysis facts, or specifications mainly as prompt-time context rather than externalizing repository-level knowledge into persistent artifacts that can be reused across generation and repair.
Feedback-driven repair and agent-based translation. Another related line studies iterative correction with compiler diagnostics, test feedback, and agent-style tool use. This includes Rust compilation repair [45], broader LLM-based automated program repair [7], and agentic repair or translation frameworks such as RepairAgent [46], LLM-powered translation agents [47], and TRANSAGENT [48]. SmartC2Rust [9] brings this paradigm directly into repository-level C-to-Rust translation by iteratively repairing generated Rust code using compilation and semantic feedback. However, its heavy reliance on repair can allow hallucinated pseudo-implementations that pass tests superficially.
VIII. Conclusion
This paper presented SpeC2Rust, a specification-driven pipeline for repository-level C-to-Rust translation. The core idea of SpeC2Rust is to externalize repository-level knowledge before Rust generation, preserve it as reusable specification artifacts, and selectively reinject it during generation and repair through Project-Intent Structuring, Spec-Guided Generation, and Layered-Feedback Repair. We evaluated SpeC2Rust on eight repository-level open-source C projects, and the results show that it compiles successfully and passes the original end-to-end test scripts on all eight projects, while eliminating raw-pointer declarations, raw-pointer dereferences, and unsafe lines of code in the final translated Rust repositories. On the five projects where direct comparison with SmartC2Rust is possible, SpeC2Rust reduces monetary cost by 66.1%, end-to-end latency by 77.3%, and input-token usage by 84.7%. Future work could extend this direction to broader classes of C systems, including library projects, and combine specification-guided translation with stronger validation techniques such as fuzzing and differential testing.
REFERENCES
[1] L. Szekeres, M. Payer, T. Wei, and D. Song, “Sok: Eternal war in memory,” in 2013 IEEE Symposium on Security and Privacy, SP 2013, Berkeley, CA, USA, May 19-22, 2013. IEEE Computer Society, 2013, pp. 48–62.
[2] R. Jung, J. Jourdan, R. Krebbers, and D. Dreyer, “Rustbelt: securing the foundations of the rust programming language,” Proc. ACM Program. Lang., vol. 2, no. POPL, pp. 66:1–66:34, 2018.
[3] Immunant. (2026) c2rust. [Online]. Available: https://github.com/immunant/c2rust
[4] M. Emre, P. Boyland, A. Parekh, R. Schroeder, K. Dewey, and B. Hardekopf, “Aliasing limits on translating C to safe rust,” Proc. ACM Program. Lang., vol. 7, no. OOPSLA1, pp. 551–579, 2023.
[5] H. F. Eniser, H. Zhang, C. David, M. Wang, M. Christakis, B. Paulsen, J. Dodds, and D. Kroening, “Towards translating real-world code with llms: A study of translating to rust,” CoRR, vol. abs/2405.11514, 2024.
[6] M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. de Oliveira Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman, A. Ray, R. Puri, G. Krueger, M. Petrov, H. Khlaaf, G. Sastry, P. Mishkin, B. Chan, S. Gray, N. Ryder, M. Pavlov, A. Power, L. Kaiser, M. Bavarian, C. Winter, P. Tillet, F. P. Such, D. Cummings, M. Plappert, F. Chantzis, E. Barnes, A. Herbert-Voss, W. H. Guss, A. Nichol, A. Paino, N. Tezak, J. Tang, I. Babuschkin, S. Balaji, S. Jain, W. Saunders, C. Hesse, A. N. Carr, J. Leike, J. Achiam, V. Misra, E. Morikawa, A. Radford, M. Knight, M. Brundage, M. Murati, K. Mayer, P. Welinder, B. McGrew, D. Amodei, S. McCandlish, I. Sutskever, and W. Zaremba, “Evaluating large language models trained on code,” CoRR, vol. abs/2107.03374, 2021.
[7] C. S. Xia, Y. Wei, and L. Zhang, “Automated program repair in the era of large pre-trained language models,” in 45th IEEE/ACM International Conference on Software Engineering, ICSE 2023, Melbourne, Australia, May 14-20, 2023. IEEE, 2023, pp. 1482–1494.
[8] V. Nitin, R. Krishna, L. L. do Valle, and B. Ray, “C2saferrust: Transforming C projects into safer rust with neurosymbolic techniques,” IEEE Trans. Software Eng., vol. 52, no. 2, pp. 618–630, 2025.
[9] M. Shiraishi, Y. Cao, and T. Shinagawa, “Smartc2rust: Iterative, feedback-driven c-to-rust translation via large language models for safety and equivalence,” arXiv preprint arXiv:2409.10506, 2024.
[10] H. Zhang, C. David, M. Wang, B. Paulsen, and D. Kroening, “Scalable, validated code translation of entire projects using large language models,” Proc. ACM Program. Lang., vol. 9, no. PLDI, pp. 1616–1641, 2025.
[11] M. Emre, R. Schroeder, K. Dewey, and B. Hardekopf, “Translating C to safer Rust,” Proc. ACM Program. Lang., vol. 5, no. OOPSLA, pp. 1–29, 2021.
[12] M. Ling, Y. Yu, H. Wu, Y. Wang, J. R. Cordy, and A. E. Hassan, "In Rust we trust: A transpiler from unsafe C to safer Rust," in 44th IEEE/ACM International Conference on Software Engineering: Companion Proceedings, ICSE Companion 2022, Pittsburgh, PA, USA, May 22-24, 2022. ACM/IEEE, 2022, pp. 354–355.
[13] M. Lachaux, B. Rozière, L. Chanussot, and G. Lample, “Unsupervised translation of programming languages,” in Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020, pp. 20601–20611.
[14] J. Hong and S. Ryu, “Type-migrating C-to-Rust translation using a large language model,” Empirical Software Engineering, vol. 30, no. 1, p. 3, 2025.
[15] c4. (2026) c4. [Online]. Available: https://github.com/momo-trip/SmartC2Rust/tree/main/benchmark/c4
[16] H. Zhang, C. David, Y. Yu, and M. Wang, “Ownership guided C to Rust translation,” in Computer Aided Verification - 35th International Conference, CAV 2023, Paris, France, July 17-22, 2023, Proceedings, Part III, ser. Lecture Notes in Computer Science, vol. 13966. Springer, 2023, pp. 459–482.
[17] R. Li, B. Wang, T. Li, P. Saxena, and A. Kundu, “Translating C to Rust: Lessons from a user study,” CoRR, vol. abs/2411.14174, 2024.
[18] J. Hong and S. Ryu, “To tag, or not to tag: Translating C’s unions to Rust’s tagged unions,” in Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, ASE 2024, Sacramento, CA, USA, October 27 - November 1, 2024. ACM, 2024, pp. 40–52.
[19] yank. (2026) yank. [Online]. Available: https://github.com/momo-trip/SmartC2Rust/tree/main/benchmark/yank
[20] sds. (2026) sds. [Online]. Available: https://github.com/momo-trip/SmartC2Rust/tree/main/benchmark/sds
[21] which. (2026) which-2.21. [Online]. Available: https://github.com/momo-trip/SmartC2Rust/tree/main/benchmark/which-2.21
[22] cat. (2026) cat. [Online]. Available: https://github.com/vikramnitin9/c2saferrust/tree/main/coreutils/src/cat
[23] pwd. (2026) pwd. [Online]. Available: https://github.com/vikramnitin9/c2saferrust/tree/main/coreutils/src/pwd
[24] M. J. Hamid. (2026) shc. [Online]. Available: https://github.com/neurobin/shc
[25] GNU. (2026) cflow. [Online]. Available: https://www.gnu.org/software/cflow/
[26] C. Wang, T. Yu, J. Wang, D. Chen, W. Zhang, Y. Shi, X. Gu, and B. Shen, “EVOC2RUST: A skeleton-guided framework for project-level c-to-rust translation,” CoRR, vol. abs/2508.04295, 2025.
[27] Y. Yan, Y. Feng, J. Liu, D. Liu, Z. Liu, H. Teng, and B. Xu, “C2rustxw: Program-structure-aware c-to-rust translation via program analysis and LLM,” CoRR, vol. abs/2603.28686, 2026.
[28] A. R. Ibrahimzada, K. Ke, M. Pawagi, M. S. Abid, R. Pan, S. Sinha, and R. Jabbarvand, “AlphaTrans: a neuro-symbolic compositional approach for repository-level code translation and validation,” in Proceedings of the ACM Conference on Foundations of Software Engineering, FSE 2025. ACM, 2025.
[29] F. Zhang, B. Chen, Y. Zhang, J. Keung, J. Liu, D. Zan, Y. Mao, J. Lou, and W. Chen, “Repocoder: Repository-level code completion through iterative retrieval and generation,” in Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023. Association for Computational Linguistics, 2023, pp. 2471–2484.
[30] G. Ou, M. Liu, Y. Chen, X. Peng, and Z. Zheng, “Repository-level code translation benchmark targeting rust,” CoRR, vol. abs/2411.13990, 2024.
[31] E. K. Smith, E. T. Barr, C. L. Goues, and Y. Brun, “Is the cure worse than the disease? overfitting in automated program repair,” in Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2015, Bergamo, Italy, August 30 - September 4, 2015. ACM, 2015, pp. 532–543.
[32] J. Yang, A. Zhikhartsev, Y. Liu, and L. Tan, “Better test cases for better automated program repair,” in Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2017, Paderborn, Germany, September 4-8, 2017. ACM, 2017, pp. 831–841.
[33] Y. Bai and T. Palit, “RustAssure: differential symbolic testing for llm-transpiled c-to-rust code,” CoRR, vol. abs/2510.07604, 2025.
[34] X. Yang, Y. Chen, E. Eide, and J. Regehr, “Finding and understanding bugs in C compilers,” in Proceedings of the 32nd ACM SIGPLAN
Conference on Programming Language Design and Implementation, PLDI 2011, San Jose, CA, USA, June 4-8, 2011. ACM, 2011, pp. 283–294.
[35] C. Cadar, D. Dunbar, and D. R. Engler, “KLEE: unassisted and automatic generation of high-coverage tests for complex systems programs,” in 8th USENIX Symposium on Operating Systems Design and Implementation, OSDI 2008, San Diego, California, USA, December 8-10, 2008. USENIX Association, 2008, pp. 209–224.
[36] M. D. Ernst, J. H. Perkins, P. J. Guo, S. McCamant, C. Pacheco, M. S. Tschantz, and C. Xiao, “The daikon system for dynamic detection of likely invariants,” Science of Computer Programming, vol. 69, no. 1–3, pp. 35–45, 2007.
[37] R. C. Waters, “Program translation via abstraction and reimplementation,” IEEE Trans. Software Eng., vol. 14, no. 8, pp. 1207–1228, 1988.
[38] X. Wu and B. Demsky, “Genc2rust: Towards generating generic rust code from C,” in 47th IEEE/ACM International Conference on Software Engineering, ICSE 2025, Ottawa, ON, Canada, April 26 - May 6, 2025. IEEE, 2025, pp. 90–102.
[39] Y. Gao, C. Wang, P. Huang, X. Liu, M. Zheng, and X. Zhang, “PR2: peephole raw pointer rewriting with llms for translating C to safer rust,” CoRR, vol. abs/2505.04852, 2025.
[40] R. Pan, A. R. Ibrahimzada, R. Krishna, D. Sankar, L. P. Wassi, M. Merler, B. Sobolev, R. Pavuluri, S. Sinha, and R. Jabbarvand, “Lost in translation: A study of bugs introduced by large language models while translating code,” in Proceedings of the 46th IEEE/ACM International Conference on Software Engineering, ICSE 2024, Lisbon, Portugal, April 14-20, 2024. ACM, 2024, pp. 82:1–82:13.
[41] A. Z. H. Yang, Y. Takashima, B. Paulsen, J. Dodds, and D. Kroening, “VERT: polyglot verified equivalent rust transpilation with large language models,” in 40th IEEE/ACM International Conference on Automated Software Engineering, ASE 2025, Seoul, Korea, Republic of, November 16-20, 2025. IEEE, 2025, pp. 1453–1463.
[42] T. Zhou, H. Lin, S. Jha, M. Christodorescu, K. Levchenko, and V. Chandrasekaran, “Llm-driven multi-step translation from C to rust using static analysis,” CoRR, vol. abs/2503.12511, 2025.
[43] X. Cai, J. Liu, X. Huang, Y. Yu, H. Wu, C. Li, B. Wang, I. N. B. Yusuf, and L. Jiang, “Rustmap: Towards project-scale c-to-rust migration via program analysis and LLM,” in Engineering of Complex Computer Systems - 29th International Conference, ICECCS 2025, Hangzhou, China, July 2-4, 2025, Proceedings, ser. Lecture Notes in Computer Science, Y. Zhou, S. G. Teo, X. Xie, Z. Ding, and Y. Liu, Eds., vol. 15746. Springer, 2025, pp. 283–302.
[44] V. Nitin and B. Ray, “Spectra: Enhancing the code translation ability of language models by generating multi-modal specifications,” CoRR, vol. abs/2405.18574, 2024.
[45] P. Deligiannis, A. Lal, N. Mehrotra, and A. Rastogi, “Fixing rust compilation errors using llms,” CoRR, vol. abs/2308.05177, 2023.
[46] I. Bouzenia, P. T. Devanbu, and M. Pradel, “Repairagent: An autonomous, llm-based agent for program repair,” in 47th IEEE/ACM International Conference on Software Engineering, ICSE 2025, Ottawa, ON, Canada, April 26 - May 6, 2025. IEEE, 2025, pp. 2188–2200.
[47] H. Sim, H. Cho, Y. Go, Z. Fu, A. Shokri, and B. Ravindran, “Large language model-powered agent for C to rust code translation,” CoRR, vol. abs/2505.15858, 2025.
[48] Z. Yuan, W. Chen, H. Wang, K. Yu, X. Peng, and Y. Lou, "TRANSAGENT: an llm-based multi-agent system for code translation," CoRR, vol. abs/2409.19894, 2024.