RustConf 2018 - C2Rust: Migrating Legacy Code to Rust by Per Larsen
Channel: Rust
Date: 2018-09-06

RustConf 2018 - C2Rust: Migrating Legacy Code to Rust by Per Larsen

Although Rust is safer and more modern than C/C++, it is still difficult to justify the cost of migrating existing, mature systems code.

This talk will present a trifecta of tools to address the costs and risks of such migration efforts. The first tool is a transpiler which generates structurally equivalent-yet-unsafe Rust code from the input C code. The second is a dynamic analysis tool which runs the original C code alongside the new Rust code to check whether they are performing the same computations. The third is a refactoring tool which helps programmers idiomize the output of our transpiler.

Our aim is to automate many of the steps that are entirely manual when migrating from C to Rust today. However, we do not expect that the migration process will be fully automatic. Therefore, we focus on detecting unexpected discrepancies as the programmer gradually rewrites the transpiled code to make better use of Rust idioms. Our tools are open source and available to anyone.

Additional resources:

Code: https://www.github.com/immunant/c2rust
Demo: https://www.c2rust.com
Slides: https://www.ics.uci.edu/~perl/rustconf18_c2rust.pdf
Writeup: https://galois.com/blog/2018/08/c2rust/