Rust rocks, but wide-scale use remains years away

Though powerful and safe, Rust still can't overcome the typical inertia of software projects

Rust rocks, but wide-scale use remains years away
Credit: Brocken Inaglory

The Rust language has earned fans because it helps developers create software that runs with the speed and efficiency of C, but with fewer security and stability pitfalls. As the language matures, calls arise to use it to rewrite critical systems infrastructure and popular applications to make them less fragile and vulnerable.

It's a good idea in the abstract. But getting there is going to be a slow, slow, slow process. Not only is translating projects from C into Rust harder than translating a CSV into an Excel spreadsheet, but the sheer size and inertia of most software projects -- even ones that aren't very large -- are the real obstacles.

Not coming soon: "RustgreSQL"

One example of this surfaced recently in a discussion on the pgsql-hackers mailing list, used by the developers of the open source PostgreSQL database. Joel Jacobson, a PostgreSQL developer and database architect at Trustly Group AB, wondered whether anyone was considering porting PostgreSQL (written in C) to Rust. "I would like to be productive in a safe system language," wrote Jacobson, "a category in which Rust seems to be alone."

The short answer was no, such a project currently isn't in the works. A longer answer, as provided by Craig Ringer of PostgreSQL support and training outfit 2ndQuadrant, made it clear why such a task would be intensely complicated, even apart from the business of porting from one language to another.

PostgreSQL's developers, wrote Ringer, "struggle to get any acceptance of the most trivial added dependences. Even optionally. We still support a more-than-10-year-old Perl. We still use C89. The project is very conservative and expects new releases to run on ancient UNIXes long forgotten by the rest of the world."

In other words, the need for better tools for translating C to Rust (such as Corrode) isn't the holdup. The project's environment -- the platforms it needs to support, the toolchain that has grown up around it, the expectations people have for it -- would all need to be either preserved as-is or transferred element by element to a Rust port. Unless the bevy of developers around PostgreSQL are all motivated to go Rust, it'll be an uphill battle.

"[Moving PostgreSQL to] a restricted subset of C++ is a lot more likely," added Ringer.

Baby steps

So far, most of the realistic goals floated don't involve porting an entire project to Rust, but rather select and specific pieces first -- the parts that are most vulnerable and would benefit best from reimplementation in the new language. The development team for librsvg, a package used in the GNOME desktop to render SVG images, recently announced it was implementing parts of its code in Rust rather than C for "memory safety and nicer built-in abstractions for the code, as well as an easier way to do unit tests."

Total rewrites of big-scale projects are years, if not decades, away. Mozilla Firefox, the browser that spurred the creation of Rust as part of the quest for a more efficient rendering engine, is starting to see key pieces implemented in Rust. But we're still ages away from Firefox going Rust from the inside out, and the rest of the world won't likely move any faster.