The Ladybird browser project has chosen Rust as the language it intends to use for a gradual move away from C++, citing memory safety, a mature systems-programming ecosystem and familiarity among contributors. The change will happen subsystem by subsystem rather than through an immediate rewrite of the browser engine.

Project leaders had been looking for a memory-safe successor to C++ for some time. They previously investigated Swift, but concluded that its interoperability with C++ and support beyond Apple platforms were not sufficient for Ladybird’s needs. Rust was also assessed in 2024 and initially rejected because its ownership model did not align comfortably with the web platform’s object model, which relies heavily on garbage collection and deep inheritance structures.

Ladybird has now made what it describes as a pragmatic choice. The project pointed to Rust’s safety properties and systems tooling, as well as its adoption within the Firefox and Chromium codebases. Its first conversion target was a portion of LibJS, Ladybird’s JavaScript engine. The selected components included the lexer, parser, abstract syntax tree and bytecode generator, areas that are relatively self-contained and covered by the test262 test suite.

Artificial-intelligence coding tools played a large role in that first port. According to Ladybird, Claude Code and Codex were used to help translate the implementation through hundreds of small, directed prompts. A human developer selected the sequence of work and the desired structure, then used several review passes in which different models were asked to find errors and unsuitable patterns. The project explicitly characterized the process as human-directed rather than autonomous.

The result comprised roughly 25,000 lines of Rust and took about two weeks, compared with an estimated several months for a manual port. Ladybird says it required both pipelines to produce matching output. Its checks found identical abstract syntax trees from the C++ and Rust parsers and identical bytecode from the two compilers. It also reported no regressions on the JavaScript performance benchmarks it follows. Additional browser testing ran both implementations together and compared their output for JavaScript encountered while navigating the web.

Compatibility took precedence over producing idiomatic Rust in this initial version. Some elements deliberately reproduce C++ implementation choices, including register-allocation patterns, to preserve equivalent bytecode. The team plans to simplify the Rust once it is confident that the corresponding C++ path can be retired.

The adoption does not make porting the browser’s central development priority. Ladybird said engine work will continue in C++ while selected Rust components coexist through defined interoperability boundaries. The core team intends to control the order and scope of future ports, and has asked contributors to coordinate before beginning conversions so that work aligns with what the project can accept.