Coding

Bun ported to Rust in 6 days

A 6-day code sprint has successfully ported Bun, a high-performance JavaScript runtime, to Rust, a systems programming language, marking a significant milestone in the pursuit of native, zero-CPU-overhead execution for web applications. This achievement leverages Rust's ownership model and borrow checker to eliminate runtime errors and memory safety issues. The port's rapid completion underscores the growing appeal of Rust as a platform for building high-performance, secure, and efficient web infrastructure.

Bun, the high-performance JavaScript runtime originally written in Zig, has been ported to Rust in a six-day code sprint. The rewrite passes 99.8% of Bun's pre-existing test suite on Linux x64 glibc, according to the project's lead developer. The port covers approximately 960,000 lines of code.

What changed

The Rust port maintains the same core codebase structure as the Zig version. The key difference is that Rust's ownership model and borrow checker now enforce lifetimes of types at compile time, and the language provides destructors when needed. Code sections that cannot be proven safe by the compiler are marked unsafe, which the developer says "encourages refactoring" of those parts.

Motivation

The stated reason for the port is to reduce time spent fixing memory leaks, crashes, and stability issues. The developer wrote: "I am so tired of worrying about & spending lots of time fixing memory leaks and crashes and stability issues. it would be so nice if the language provided more powerful tools for preventing these things."

Build performance

When using Bun's own faster Zig compiler, the Rust port compiles at the same speed as the original Zig build. If built with the upstream Zig compiler, the Rust version compiles faster.

What's next

The developer has announced a forthcoming blog post covering benchmarks, memory usage, maintainability going forward, and the literal process of doing the port — noting it was not simply a matter of asking an AI to "rewrite bun in rust. make no mistakes." The port currently works on Linux and will be extended to other platforms.

Bottom line

A 960,000-line runtime rewrite completed in six days and passing nearly all existing tests is unusual. The port trades Zig's manual memory management for Rust's compile-time safety guarantees, which the developer expects to reduce long-term maintenance burden from memory-related bugs.

Similar Articles

More articles like this

Coding 1 min

Visual Studio Code 1.120

Visual Studio Code’s 1.120 update slashes debugging friction with native Data Breakpoints, letting engineers pause execution when specific object properties change—not just memory addresses. The release also bakes in GitHub Copilot-powered inline code completions for Python, JavaScript, and TypeScript, cutting keystrokes by up to 40% in early benchmarks, while a revamped terminal shell integration finally bridges the gap between local and remote workflows.

Coding 1 min

"Dirty Frag" (CVE-2026-43284): The Second Linux Root Exploit in Eight Days

A devastating Linux root exploit, dubbed "Dirty Frag," has emerged, capitalizing on a previously unknown vulnerability in the Linux kernel's networking stack, specifically in the handling of IPv6 fragmentation (CVE-2026-43284). This marks the second high-severity Linux exploit in just eight days, underscoring the growing urgency for kernel patching and vulnerability mitigation in the face of escalating cyber threats. The exploit's ease of exploitation and widespread kernel adoption amplify its potential impact.

Coding 1 min

GrapheneOS fixes Android VPN leak Google refused to patch

Android's VPN security gap, long dismissed by Google, has been plugged by GrapheneOS, a custom Android variant, through a patch that exploits a workaround for a kernel vulnerability, effectively bypassing the company's refusal to address the issue. The fix leverages a Linux kernel module to intercept and encrypt VPN traffic, circumventing a known flaw in Android's VPN implementation. This patch underscores the limitations of Google's control over Android's security.

Coding 1 min

Show HN: Mochi.js: bun-native high-fidelity browser automation library

A Bun-native browser automation library, Mochi.js, bypasses anti-bot defenses by eschewing superficial client-side probes in favor of raw Chrome DevTools Protocol (CDP) parity with stock Chromium, outperforming forked browsers by avoiding detectable artifacts. Built on a WAF-aware probe manifest, it targets the actual heuristics used by CAPTCHAs and web application firewalls, enabling high-fidelity automation without the need for deception. The framework’s JS-layer approach redefines browser automation by prioritizing consistency over cosmetic mimicry.

Coding 1 min

Bun's experimental Rust rewrite hits 99.8% test compatibility on Linux x64 glibc

Rust's growing adoption gets a significant boost as Bun, a high-performance JavaScript runtime, achieves near-flawless test compatibility on Linux x64 glibc with its experimental Rust rewrite, boasting an impressive 99.8% test pass rate. This milestone marks a crucial step towards mainstream adoption of Rust in the Linux ecosystem. The achievement underscores the potential for Rust to become a go-to language for building high-performance, secure applications.

Coding 1 min

All my clients wanted a carousel, now it's an AI chatbot

The rise of conversational interfaces has turned a once-standard design element into a redundant relic, as clients increasingly demand AI-powered chatbots to replace static carousels in digital product experiences. This shift is driven by the growing adoption of large language models, which enable seamless, human-like interactions that were previously the exclusive domain of bespoke development. As a result, designers are reevaluating the role of traditional UI elements in favor of more dynamic, AI-driven interfaces.