Ladybird Browser Components Rewritten in Rust with AI

Andreas Kling, founder of the web browser Ladybird, announced the decision to use the Rust language when developing the project and began rewriting parts of Ladybird in this language. As an experiment with C++, the JavaScript engine LibJS has already been rewritten in Rust. LibJS was chosen due to its good test coverage, which simplifies the assessment of the porting quality.

To speed up the porting, AI assistants Claude Code and OpenAI Codex were used, thanks to which the code was rewritten in two weeks. The translation was carried out progressively with the participation of the developer, who in the process of work sent several hundred prompts to the AI ​​assistants, deciding in what sequence and what to port, as well as specifying the requirements for the resulting Rust code. After receiving the code in different AI models, the result was reviewed and the code was analyzed for errors and questionable decisions.

As a result, the version of the engine rewritten in Rust successfully passed all 52,898 tests for compatibility with ECMAScript from the set test262 and 12,461 regression texts from the Ladybird project. The Rust version demonstrated complete coincidence of the generated AST and bytecode with the C++ version; no regressions have yet been identified. JavaScript tests also showed no performance degradation. In addition, complete agreement was shown by comparative testing of the results of processing sites using LibJS variants in C++ and Rust.

Rewriting browser components in Rust is considered a minor project that can take a lot of time. Main development is still ongoing in C++. Decisions about subsystems that will be rewritten in Rust will be made by the core development team. The new Rust code will coexist with existing C++ code through explicitly defined levels of interoperability.

Notably, Ladybird’s developers decided to use the Swift programming language in 2024, but encountered insufficient interoperability with C++ code and limited support for non-Apple platforms. As for Rust, the language has a more mature ecosystem for systems programming and security guarantees. In addition, there are many Ladybird developers who are familiar with this language. In 2024, Rust was not approved for use in Ladybird due to the ownership-based development paradigm, which does not fit well with the object-oriented style of C++.

Andreas Kling once worked at Nokia developing KHTML, and then at Apple as one of the developers of Safari. The Ladybird project was originally created as an application for the SerenityOS operating system, but in the summer of 2024 it was spun off into a separate project and received a donation of $1 million. The browser is written in C++ and distributed

/Reports, release notes, official announcements.