Canonical is co-funding a three-year doctoral research project with UK Research and Innovation and the University of Bristol's Programming Languages Research Group to explore using large language models for converting legacy C codebases to Rust. The research methodology breaks down massive codebases—spanning hundreds of thousands of lines—into smaller components, allowing AI to rewrite each section safely, correctly, and sustainably.
Traditional code translation tools preserve C's structure too literally, resulting in Rust code that relies heavily on unsafe operations and demands extensive manual refactoring. This new approach aims to avoid those pitfalls by letting AI handle decomposition and intelligent reconstruction. The research will focus on preserving implicit knowledge embedded in mature codebases—decades of corrections, patches, and edge-case handling that rarely appear in official documentation.
Canonical is using two real Ubuntu ecosystem tools as test cases: AppArmor (the security utility) and snap-confine. While Canonical previously tested Rust in Ubuntu 25.10 through manual rewrites like sudo-rs and uutils for coreutils, this research will provide concrete data on AI automation effectiveness for large-scale codebases. The goal is to demonstrate whether machine learning can successfully translate production code at scale, not just in controlled academic examples.