Rust

Hand-drawn notched terracotta plates joined in pairs by short terracotta clasps, over interlocking sand, umber and moss hatched blocks.

Rust is a systems programming language whose compiler checks ownership and borrowing to prevent memory errors without a garbage collector, a service that reclaims memory at runtime (The Rust Core Team, 2015a; Klabnik et al., n.d.c). Code marked unsafe can perform extra operations whose safety the programmer must establish. In one study of bug reports, memory-safety bugs traced to such code or to compiler defects, while safe Rust can still have concurrency bugs (The Rust Project, n.d.f; Xu et al., 2021; Qin et al., 2020). Most Rust-adopting Android components with public records had no memory-safety vulnerabilities reported afterwards, but adoption favoured components with a history of them (Fan et al., 2026b). Developers report a steep learning curve, and Linux maintainers disagreed about how to maintain Rust and C code together (Fulton et al., 2021; Janulgue, 2025). For coding agents writing Rust, the share of ownership errors depends on the task: 16.7% of error labels in one short-program benchmark, 1.7% of diagnostics in one port (Nogueira et al., 2026c; Toub, 2026a).

Ownership, borrowing and lifetimes

Rust’s memory safety rests on rules about who owns a value and who may use it. Each value has one owner at a time, and when that owner goes out of scope, Rust drops the value. A borrow gives code a reference to a value while leaving ownership where it is. Ordinary references permit either one mutable reference, which can change the value, or several shared references at once (Klabnik et al., n.d.d; Klabnik et al., n.d.a).

The borrow checker, the part of the compiler that enforces these rules, follows how values and references are used along the program’s possible paths. A reference’s lifetime describes where it must stay valid. Lifetime parameters state how input and output references are related, so the checker can reject references that would outlive the values they point to (Pearce, 2021; Klabnik et al., n.d.c).

The checks can reject a program whose actual execution would be safe. The standard library type RefCell offers an alternative for some cases by checking borrowing rules while the program runs. In August 2026 the Rust Project announced a trial version of the Polonius borrow checker. It accepts some code the earlier checker rejected by telling apart lifetime relationships on separate branches (Klabnik & Nichols, n.d.; Huey, 2026).

Unsafe code and what the guarantees cover

Rust’s guarantees hold for safe code and depend on unsafe code meeting its conditions. An unsafe block allows operations such as reading through a raw pointer, an address with fewer compiler checks than a reference. The borrow checker still checks ordinary references inside the block (The Rust Project, n.d.f; Klabnik et al., n.d.b).

A library can use unsafe code internally and offer an interface callable from safe Rust. That interface is sound if no caller using it from safe code can trigger undefined behaviour, execution for which the language gives no guarantees (The Rust Project, n.d.b; Jung et al., 2018).

RustBelt gave a machine-checked safety proof for a model of part of Rust, covering programs that pass its type checks and confine unsafe code to such libraries. The initial model left out some features, such as cleanup after a panic interrupts execution. A follow-up extended it to some atomic operations used to share data between threads (Jung et al., 2018; Dang et al., 2020). Verifying encryption code examines proofs that particular programs meet further requirements.

Most published crates, the units in which Rust code is compiled, use no unsafe code, though the share depends on how it is counted. In January 2020, 76.4% of 31,867 crates compiled from the public registry used no explicit unsafe features. A substantial share of functions exposed as unsafe existed to work with hardware or call C code (Astrauskas et al., 2020). In May 2024 the Rust Foundation found the unsafe keyword in 24,362 (19.11%) of about 127,000 crates it classified as containing significant code (Rust Foundation Team, 2024).

Checking unsafe code

The safety of an unsafe operation can depend on conditions set up by surrounding safe code. For example, a safe method can change the state that an unsafe operation relies on. Review therefore covers both the operation and the code that establishes those conditions (The Rust Project, n.d.i).

Miri can run tests or programs and detect some forms of undefined behaviour. A passing run gives evidence about the executions it checked. Soundness requires the safety conditions to hold for every safe caller (The Rust Project, n.d.d).

Pointer aliasing

The rules for pointer aliasing, where several pointers refer to the same memory, are still unsettled. The Rust Reference leaves them open, and two research models, Stacked Borrows and Tree Borrows, permit different sets of programs. The Tree Borrows authors tested compatibility with safe Rust and left a general proof of it open (The Rust Project, n.d.b; Jung et al., 2020; Villani et al., 2025).

Traits, threads and concurrency bugs

A trait defines shared behaviour that different types can implement, and generic code can require its types to implement one so it can use the trait’s operations (The Rust Project, n.d.g). Traits also govern how threads, separate flows of work in a program, share data. The Send trait marks types whose values can pass to another thread, and Sync marks types whose shared references can (Jung et al., 2018).

Rust also supports asynchronous work through futures. A future represents work that makes progress when code checks whether it is ready, and an await expression suspends the current computation until its future produces a value (Drodt, 2026; The Rust Project, n.d.a).

Concurrency failures also occur in safe Rust. A study of 170 bug reports on human-written Rust included 100 concurrency bugs, 59 of which involved waiting that could not proceed. Operations that coordinate threads caused 55 of those 59 blocking bugs (Qin et al., 2020). Of the other 41 concurrency bugs, 25 occurred in safe code (Qin et al., 2020). These counts describe the mix of failures in selected reports.

Rust written by coding agents

Compiler diagnostics and feedback Weak evidence: few or small studies support this

The compiler diagnostics coding agents hit most often when resolving Rust repository issues concern finding project code. In one benchmark, names, scope and paths accounted for 43.7% of diagnostics, and type and trait errors for 32.6%. An unavailable method on a type, diagnostic E0599, alone accounted for 18.06% (Xiang et al., 2026b).

Ownership diagnostics made up different shares in short-program generation and in one port. With baseline prompts in the short-program benchmark, ownership and lifetimes accounted for 16.7% of Rust compiler error labels. In GitHub’s Copilot-assisted TypeScript-to-Rust port, ownership, borrowing and lifetimes made up 1.7% of coded compiler diagnostics (Nogueira et al., 2026c; Toub, 2026a).

Compiler feedback during generation reduced compilation failures in a preprint’s experimental setup. Across its two Rust workloads, the average share of uncompilable outputs was 20.7% with feedback after generation. Adding feedback during generation brought it to 13.1% (Mündler-Sasahara et al., 2026).

Cargo, Rust’s build tool, provides quick compiler feedback through cargo check, which stops before final code generation. Some diagnostics appear only during code generation. The command cargo test --no-run builds the test executables so those diagnostics can surface before the tests run (The Rust Project, n.d.j; The Rust Project, n.d.k).

Crate names and API versions

Generated Rust can name crates that do not exist. One study classified 10,779 of 48,494 crate recommendations from 16,764 snippets as invented. A separate experiment found that, on average across 11 models, 24.74% of Rust prompts yielded at least one nonexistent package (Zheng et al., 2026e; Krishna et al., 2025).

Cargo downloads external crates based on dependency declarations in the project’s Cargo.toml. An invented name in a source file can therefore appear in generated code without becoming a dependency (Zheng et al., 2026e).

Changes in how a library function behaves are especially difficult for models to follow. On RustEvo², models passed on their first attempt on average 65.8% of the time for newly stabilized interfaces and 38.0% for changes in behaviour (Liang et al., 2025).

Documentation about the target version improved first-attempt success on an extension of that benchmark. Compared with prompts without API documentation, retrieving version-change details raised success from 24.86% to 29.38% for Llama 3.1 8B. It rose from 28.67% to 41.81% for Qwen 2.5 7B on the same comparison, with tests run on the target Rust version (Lin et al., 2026a).

Ownership, asynchronous work and cleanup Weak evidence: few or small studies support this

Ownership review can catch unnecessary copies in code that runs correctly. Cloning a reference-counted pointer shares its data, while cloning some other values copies the data in full. In GitHub’s port, one read-only scan copied a 260 MB event log that it could have borrowed (The Rust Project, 2026b; Toub, 2026a).

An asynchronous task can compile and still deadlock if it holds a lock across an await. Some lock guards implement Send, so the compiler accepts holding them across an await. Clippy, a tool that flags selected code patterns, warns about holding certain guards across an await (Tokio contributors, n.d.; The Rust Project, n.d.c).

Cancellation tests can check whether an interrupted operation releases its resources. In GitHub’s port, cancelling between the announcement and startup of a shell left it active. GitHub attributed almost all of the port’s missing-feature regressions to insufficient end-to-end tests, which exercise behaviour through the whole system (Toub, 2026a).

Comparing implementations on the same inputs can expose incorrect error handling. In a C-to-Rust port of the cJSON library, that comparison found a case where an agent’s version returned infinity on numeric overflow instead of reporting an error (Parrillo et al., 2026).

Memory-safety defects in practice

Studies of bug reports trace Rust’s memory-safety bugs to unsafe code and compiler defects. In 186 bug reports, including the Rust memory-safety vulnerabilities in public records through December 2020, every memory-safety bug except a compiler bug required unsafe code (Xu et al., 2021). A separate study of compiler bug reports found defects that let safe Rust programs show behaviour the language leaves undefined (Liu et al., 2025b).

Android vulnerability reports Weak evidence: few or small studies support this

Android’s public records show few memory-safety vulnerabilities after Rust adoption, but they cannot show how much the language caused. Only 14 of 67 Rust-adopting components had public vulnerability records, matched by file path. Of those, 11 had no reported memory-safety vulnerabilities after Rust first appeared, over follow-up periods that differed (Fan et al., 2026b). Adoption prioritized components with a history of frequent memory-safety vulnerabilities, which limits what the comparison can attribute to Rust (Fan et al., 2026b).

Google’s own estimate is about 0.2 memory-safety vulnerabilities per million lines of Android Rust, against roughly 1,000 per million lines historically for C and C++. The Rust figure rests on one potential vulnerability, fixed before release, in about five million lines; the C and C++ figure covers a separate body of code (Vander Stoep, 2025).

Linux kernel drivers Weak evidence: few or small studies support this

The code that gives safe Rust access to lower-level kernel operations can itself introduce safety bugs. An audit of Rust code in or staged for Linux found 25 bugs; six in that access layer broke memory safety and three broke thread safety (Li et al., 2024a).

By one retrospective estimate, Rust would have prevented some past driver vulnerabilities automatically and others only with developers’ help. Researchers classified 240 historical Linux driver vulnerabilities: 82 Rust would prevent automatically, 113 would need changes from developers, and 45 it would leave unaffected (Li et al., 2024i).

Learning cost and productivity

Developers report a steep learning curve, and ownership errors are where learners struggle. In a study of 36 learners, participants struggled to explain what could go wrong at runtime when the compiler rejected code over ownership (Crichton et al., 2023). Interviews with 16 professional developers and 178 community survey responses named the steep learning curve as a drawback. In the 2024 State of Rust survey, about 31% of non-users gave perceived difficulty as their main reason (Fulton et al., 2021; The Rust Survey Team, 2025).

Better explanations may help. After a textbook chapter on ownership was revised, average quiz scores rose from 48% to 57%, in successive groups of readers who were not randomly assigned to versions (Crichton et al., 2023).

Review time and developer productivity Weak evidence: few or small studies support this

Evidence that Rust developers become productive quickly comes from one company’s measures. Google found that first-party Android Rust changes spent about 25% less time in review than C++ changes of similar size (Vander Stoep, 2025). In an earlier survey of Google’s Rust developers, more than half said they were as productive in Rust as in their other languages within four months (Bergstrom & Brennan, 2023). One measure covers a single stage of development and the other developers’ own judgments.

Performance Strong evidence: many studies agree on this

Rust’s speed relative to C and C++ depends on the task and the implementation. Across two collections of short tasks, Rust took on average 1.96 and 1.35 times as long as C. Rust programs in the second often used unsafe code that skipped some operations and checks (Zhang et al., 2022b). In a suite of parallel benchmarks, hand-written safe Rust generally ran slower than the C originals and than automatically translated Rust (Suchert & Castrillon, 2023). Overhead for Linux drivers varied substantially by driver and configuration, and a preprint comparing Rust with C++ found each faster on a different sorting routine (Li et al., 2024a; Ivanov, 2022).

Build times depend on configuration. The Rust Project benchmarks selected packages on 64-bit x86 Linux, from scratch and with parts of a previous build reused (The Rust Project, n.d.e). Its benchmarks indicated that keeping only debugging information mapping compiled code to source lines could cut the processor cycles spent building by 2% to 30%. In a survey with over 3,700 responses, average satisfaction with build performance was 6 on a scale from 0 (worst) to 10 (best) (Beránek, 2025).

History, stability and governance

Graydon Hoare began Rust as a personal project in 2006 and dates private work at Mozilla to late 2009. By his July 2010 Mozilla Summit talk, the repository was public (Hoare, 2016; Hoare, 2010).

Before 1.0, the project removed services built into the language. In 2013 Patrick Walton proposed dropping the built-in garbage-collected pointer syntax, while still envisaging a tracing garbage collector in the standard library (Walton, 2013). A 2014 design proposal (RFC 230) proposed removing the shared threading runtime, including green threads managed within the program. Its aim was to make Rust easier to embed in other programs, and the January 2015 alpha confirmed the removal (Turon, 2014; The Rust Core Team, 2015b).

Rust 1.0 in May 2015 began a stability commitment with a six-week release schedule. The plan reserved room to fix compiler bugs and safety problems, and to change type inference (The Rust Core Team, 2015a; Turon & Matsakis, 2014).

Editions let the project make some breaking changes while crates on different editions keep working together. Each crate opts in, and Rust 1.85 made the 2024 edition stable in February 2025 (The Rust Project, n.d.h; The Rust Release Team, 2025).

The independent Rust Foundation launched in February 2021, and Mozilla transferred the Rust trademark and infrastructure, including the crates.io registry, to it. In June 2023 the Rust Project formed a Leadership Council for top-level governance (Rust Foundation Team, 2021; Leadership Council, 2023).

Adoption and the Linux kernel

Rust’s use at work grew among its own community. In the 2024 project survey, 38% of respondents used Rust for most of their coding at work, up from 34%, especially for server backends, network services and cloud infrastructure. Concern about the language’s growing complexity continued in 2025 (The Rust Survey Team, 2025; The Rust Survey Team, 2026).

Linux added Rust support in version 6.1 as an experiment in whether the trade-offs were worthwhile. Users in the main kernel include the Android Binder and ASIX PHY drivers, and Google’s Android 6.12 kernel shipped its first production Rust driver (Ojeda, 2025; Rust for Linux, n.d.a; Vander Stoep, 2025).

Maintenance in Linux

Linux maintainers disagreed in 2025 about how shared Rust code should fit into core subsystems. Christoph Hellwig argued that a subsystem spanning Rust and C would be harder to maintain. Danilo Krummrich said the team offered to maintain the Rust abstraction for direct memory access (DMA) as a separate component. Sharing it, he argued, would stop each Rust driver duplicating it (Janulgue, 2025).

Rust for Linux acknowledges the costs of a second language but argues the benefits outweigh them, and lets subsystems decline Rust code, for example when maintainers lack capacity. Miguel Ojeda reported that the 2025 Maintainers Summit concluded the experiment, while support still varied by platform and some compiler combinations remained experimental (Rust for Linux, n.d.b; Ojeda, 2025).

Further reading

  • The Rust Programming Language, “References and Borrowing” explains the rules for sharing and changing a value through references (Klabnik et al., n.d.a).
  • RustBelt explains what a library must prove about its unsafe operations for code using its safe interface to be safe in the model (Jung et al., 2018).
  • Xu et al. (2021) classifies memory-safety bug reports and examines how unsafe code contributes to them.
  • Fan et al. (2026b) traces Rust’s adoption in Android and how public disclosures were matched to components.
  • Crichton et al. (2023) examines how learners understand ownership errors and evaluates a revised explanation.
  • Rust kernel policy presents the Rust for Linux project’s position on admitting Rust code into individual subsystems (Rust for Linux, n.d.b).

Known gaps

What this article cannot tell you yet.

  1. The Android comparisons do not isolate the effect of the language from differences in component selection, code age or vulnerability reporting.
  2. The productivity measures do not track how much software developers deliver over a whole project.
  3. The compiler benchmarks cover selected crates and build configurations, so they cannot provide a general compile-time comparison with other languages.
  4. The Linux maintainer discussion gives first-hand accounts of the trade-offs, without a comparative measure of long-term maintenance costs.
  5. The project’s surveys do not establish how widely Rust is used across the software industry.
  6. The early history has no separately dated record of Mozilla’s funding authorization.
  7. The diagnostic studies use different workloads and counting methods, so they do not establish how often agents hit ownership errors in comparable tasks.
  8. The API documentation comparison leaves open how much stale documentation would affect first-attempt success.
  9. The porting cases do not establish how often agents introduce unnecessary copies, blocking or cleanup failures in routine Rust changes.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 66 references