Ghostboard pixel

Ladybird Browser Just Ported C++ Code to Rust in 2 Weeks Thanks to AI

Turns out AI is pretty handy when you need to port C++ code.
Warp Terminal

We are used to seeing web browsers that are either based on Chromium or Firefox, and many people are fed up of the duopoly-like situation here. Ladybird is a breath of fresh air here, being a truly independent browser with its own engine built from scratch.

While development has been going on in full swing, we are yet to see an official release as of now. The first alpha release for it is set for release sometime in 2026 for Linux and macOS.

Nevertheless, the developers of it have just announced that they are implementing some Rust bits into it.

What's Happening?

a screenshot of an early build of ladybird browser running on macos, it shows a fangamer merchandise store listing
Placeholder Source: Ladybird

For a while now, the Ladybird team has been on the lookout for a memory-safe language to eventually replace C++. Swift was considered at one point, but poor C++ interoperability and limited platform support outside Apple's ecosystem ruled it out.

Rust was actually evaluated and rejected back in 2024. The reasoning was that it didn't play well with C++-style object-oriented programming, which the web platform relies on heavily. But after another year of searching, the lead developer of Ladybird, Andreas Kling, decided it was time to be pragmatic.

The fact that both Firefox and Chromium have already started bringing Rust into their codebases also helped make the case.

How's it Done?

Andreas started with LibJS, Ladybird's JavaScript engine, since its core parts are fairly isolated from the rest of the codebase and already have strong test coverage. Rather than writing Rust code from scratch, he used Claude Code and Codex to do the heavy lifting on the translation.

He made it very clear that human oversight was involved, with every decision about what to port, in what order, and how the Rust code should be structured coming from him. Post execution, many review passes were performed, pitting different models against each other to catch mistakes.

Two weeks later, the port was done. About 25,000 lines of Rust, something Andreas says would have eaten up several months of manual work. The results held up well too, passing over 52,000 test262 tests and around 12,000 Ladybird regression tests with no failures and no performance nerfs on any JavaScript benchmarks.

He also goes on to add that:

Beyond the test suites, I’ve done extensive testing by browsing the web in a lockstep mode where both the C++ and Rust pipelines run simultaneously, verifying that output is identical for every piece of JavaScript that flows through them.

Rust is not taking over as the project's main focus though. C++ is still front and center, and the Rust porting work is more of a slow, long-term effort running alongside it. The two will coexist through defined boundaries.

Contributors interested in helping with the port are also being asked to coordinate with the core team first before jumping in.

You can go through the announcement blog to get further information on this.


Suggested Read 📖: Not Every Browser is Built on Chrome

Not Every Browser is Built on Chrome: Explore These Firefox-based Options
Think all popular browsers out there are Chromium based? Take a look at this Firefox-based options.
About the author
Sourav Rudra

Sourav Rudra

A nerd with a passion for open source software, custom PC builds, motorsports, and exploring the endless possibilities of this world.

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.