Canonical is Funding a PhD to Automate C to Rust Translation (itsfoss.com)
- Reference: 0185109478
- News link: https://developers.slashdot.org/story/26/08/23/0458226/canonical-is-funding-a-phd-to-automate-c-to-rust-translation
- Source link: https://itsfoss.com/news/canonical-c-to-rust-automation/
> Canonical has committed funding [2]to a three-year PhD project focused on building a system that can automatically translate large C codebases into Rust. And they are not alone; [3]UK Research and Innovation is matching their funding for the project, which is set to run through the University of Bristol's [4]Programming Languages Research Group .
>
> The PhD is aiming to build an all-encompassing platform that can take a [5]C repository running into hundreds of thousands of lines and translate it into [6]Rust that's " safe, behaviourally correct and maintainable Rust ."
>
> The work will be carried out by a student, [7]Alex Wood , who will be supported by [8]Professor Meng Wang leading the work, with [9]Dr. Cristina David and Canonical's [10]Jon Seager serving as co-supervisors.
[1] https://itsfoss.com/news/canonical-c-to-rust-automation/
[2] https://discourse.ubuntu.com/t/investing-in-automated-c-to-rust-translation/86369
[3] https://www.ukri.org/
[4] https://plrg-bristol.github.io/
[5] https://www.c-language.org/
[6] https://www.rust-lang.org/en-US
[7] https://www.linkedin.com/in/alexwood2403/
[8] https://www.bristol.ac.uk/people/person/Meng-Wang-c7e34d58-549c-4456-ad41-8392dab75a91/
[9] https://www.bristol.ac.uk/people/person/Cristina-David-d78c4612-1820-443c-b2cb-9db853867d90/
[10] https://www.linkedin.com/in/jnsgruk/
don't get it (Score:2)
Why not just use the time to make a safe c library of operations and use it?
Re: (Score:2)
> Why not just use the time to make a safe c library of operations and use it?
make sense to me but almost 20 years after someone began the Safe C library it's still a work in progress?
[1]https://jacobfilipp.com/DrDobb... [jacobfilipp.com]
[1] https://jacobfilipp.com/DrDobbs/articles/DDJ/2009/0903/0903tn01/0903tn01.html
Oh, now I get it. (Score:2)
[1]Rust Performance vs C Performance [rustfaq.org]
[2]Memory Management in Embedded Systems: A Comparative Analysis of C and Rust [parvezshaik.info]
You use Rust's safety features while writing / debugging, but
turn off Rust's safety features (cargo run --release), when you're done.
That way you don't get abysmal performance from performing safety checks.
Although, couldn't this be done in C as well?
[1] https://www.rustfaq.org/en/rust-performance-vs-c-performance-benchmarks-and-reality/
[2] https://parvezshaik.info/techblogs/rustvscFullReport.html
Re: (Score:2)
turn off Rust's safety features (cargo run --release), when you're done.
That's like removing your seat belts after the vehicle crash tests are done.
Re: (Score:2)
No. Not even close.
Re: (Score:2)
> Although, couldn't this be done in C as well?
It can be. But it requires high coders skills and insights. In Rust the skill requirements are probably a bit (not that much) lower, but since Rust is hard to learn, you force competence in an indirect way. Yes, stupid, but that is one of the hoops needed to convince clueless "management".
Weâ(TM)re already doing this (Score:3)
[1]https://www.cs.wisc.edu/2025/0... [wisc.edu]
And DARPA has a whole program for it:
[2]https://www.darpa.mil/research... [darpa.mil]
[1] https://www.cs.wisc.edu/2025/07/15/translating-legacy-code-for-a-safer-future/
[2] https://www.darpa.mil/research/programs/translating-all-c-to-rust
PhD Be Vibe Codin' (Score:2)
They see me vibe codin', they hatin', tryin' to catch me debuggin' dirty. Tryin' to catch me debuggin' dirty. Tryin' to catch me debuggin' dirty. Tryin' to catch me debuggin' dirty. My IDE is open, my terminal is glowing, and my Spotify playlist is riding heavy. Think I'm just copy-pasting Caude Code, but I'm a fully funded PhD candidate.
It's not the language it's the management (Score:2)
The C code at most large companies I've worked at has been total crap. My high school CS teacher probably wouldn't have accepted the code from my last company even to mark it since it lacked descriptions of the projects and comments. This isn't something that can be fixed with a new language. C at least won't compile if someone is an idiot so usually about 25% of the C devs are worth the air they breath which is far better than the JavaScript devs. The issue is managers wanting steady, easy to measure progr
Re: (Score:2)
The problem with C is that it is easy to learn, but hard to master. The primary advantage of Rust is that it is hard to learn and hard to master. That keeps the idiots out and it probably its most significant actual security advantage.
Probably compiler level (Score:1)
I see most comments are assuming this is done with AI but this isnâ(TM)t necessary. It would make more sense to compile C to the intermediate code, then generate rust that would generate the same intermediate codes. As for unsafe rust it would be a huge win to translate all the regular C to rust, and only have some sections that need unsafe rust, vs the entire code base being essentially unsafe. An upshot of conversion might be the automatic converter canâ(TM)t find a safe equivalent for some c co
In other words... (Score:2)
In other words, they are throwing their money to influence an open source project.
How is that even possible? (Score:4, Insightful)
If the C code does something unsafe, how can it be machine-translated into safe Rust, without knowing the intention of the programmer?
And even is this is possible, what's the point? Why not just make a C compiler that emits "safe" assembler directly? It's not as if a transpiler is likely to emit human-maintainable code.
I know Canonical is all hot for Rust, but this particular project doesn't seem feasible to me.
Re: (Score:3)
You're looking at the problem in a wrong way.
C operations are unsafe and you need to implement safeguards yourself. Sometimes you can implement things rust can't because C allows you unsafe operations, but most programs only implement things that are possible in a safe way, but may fail to guard them (or have secure code that easily becomes insecure when some amateur tries to extend it).
Think of working with a zero terminated string. These operations can easily be translated into every higher level programm
Re: (Score:2)
Hopefully they make significant gains when it comes to maintainability and readability as well. A lot of AI generated code looks superficially properly commented, decent variable names, that sort of thing, but in reality is a pain to deal with and only likely to ever be worked on again by more AI.
Re: (Score:2)
It is not actually possible. Or rather unsafe stuff in C will remain unsafe in Rust. In addition, most/all other bugs (like logic errors, wrong use of system APIs, etc.) in the C code will remain. Rust does not magically make code secure. Coding directly in Rust has some advantages, as it is hard to learn and that keeps the prevalent low-skill coders out. Rust can also avoid some problems (not that many) when the code is designed for Rust. C code is obviously not.
That said, there is an application scenario