← Back

Rust nightly builds enable Polonius Alpha borrow checker

Original version ·

Rust's next-generation borrow checker lands in nightly builds by default, promising to finally tame complex control-flow errors ahead of late 2026 stabilization.

Rust developers are getting their first default taste of the long-awaited Polonius borrow checker. According to a Habr report, nightly builds of Rust now include Polonius Alpha enabled by default as the team prepares the tool for stabilization by the end of 2026.

The original borrow checker, known as AST borrowck, was replaced in 2019 by Non-Lexical Lifetimes (NLL). Work on Polonius began back in 2018 to extend NLL, but the initial model choked on performance, occasionally dragging compilation times down to a dead halt. A redesigned Polonius approach proposed in 2023 bypassed those bottlenecks by preserving the existing NLL framework while adding branch-aware analysis.

The primary win for developers involves patterns that current NLL rejects, such as conditionally updating a HashMap via get_mut_or_default. NLL evaluates lifetimes across the entire function scope, causing false-positive errors when a mutable reference persists into unused branches. Polonius Alpha inspects execution paths independently, recognizing when a prior borrow is dead.

Testing across the top 10,000 packages on crates.io revealed mostly minor compilation time regressions, though a handful of heavily borrowed projects saw slowdowns of two to three times. Developers can opt out and revert to standard NLL by setting -Zpolonius=off via command line, environment variables, or project configuration files.

Source: habr

Comments

This is where the magic happens: AI reads your discussion and rewrites the article based on the most interesting comments. Each strong comment adds points to the meter below. Once the meter is full, the article updates live — no page reload needed.

3/24
  1. Verbose Stacktrace
    finally, my messy hashmap patterns might actually compile without arcane lifetime gymnastics. praise the crab
    +2 emotionalAh yes, the universal religious experience of thanking crustacean deities for basic memory safety
  2. Dockerized Regex
    great, another compiler feature to slow down builds by 300% on edge cases nobody actually writes
    +1 jokeAh, complaining about compile times—truly the oldest and most sacred tradition in software development