Xutepsj

Rust 1.94.0 Released: Array Windows, Smarter Cargo Config, and TOML 1.1

Published: 2026-04-30 22:36:48 | Category: Technology

Introducing Rust 1.94.0

The Rust team is excited to announce the latest stable release, version 1.94.0. This update continues Rust's mission of empowering developers to build reliable and efficient software. If you already have Rust installed via rustup, upgrading is straightforward:

Rust 1.94.0 Released: Array Windows, Smarter Cargo Config, and TOML 1.1
Source: blog.rust-lang.org
rustup update stable

If you haven't installed Rust yet, head over to the official get‑started page to get rustup. For those eager to test upcoming features, you can switch to the beta or nightly channels with rustup default beta or rustup default nightly. Please report any bugs you encounter.

Key Highlights in This Release

Array Windows: Zero‑Cost Iteration with Stride

One of the most notable additions in Rust 1.94.0 is the array_windows method for slices. It functions similarly to the existing windows method, but with a crucial difference: the window length is fixed at compile time. This means that each yielded item is a reference to an array of length N (&[T; N]) rather than a dynamically sized slice (&[T]). In many cases, the compiler can infer the correct window size from how the iterator is used.

Consider a classic example from the 2016 Advent of Code puzzle that searches for ABBA patterns—two different characters followed by their reverse (e.g., xyyx or abba). With array_windows, the code becomes both concise and type‑safe:

fn has_abba(s: &str) -> bool {
    s.as_bytes()
        .array_windows()
        .any(|[a1, b1, b2, a2]| (a1 != b1) && (a1 == a2) && (b1 == b2))
}

The destructuring pattern [a1, b1, b2, a2] tells the compiler we want windows of length 4, so no explicit size parameter is needed. By contrast, the older .windows(4) approach would return a slice that requires manual indexing and relies on the optimizer to elide bounds checks. The new method eliminates that overhead at the type level.

Cargo Configuration Inclusion

Managing Cargo settings across multiple projects and environments just became easier. Cargo 1.94.0 now supports an include key in configuration files (.cargo/config.toml). This allows you to split configuration into separate files, making it simpler to share, organize, and reuse settings.

The include key can be specified as an array of paths or an array of inline tables for more control. You can also mark certain includes as optional—handy when a configuration file may not exist in all developer environments.

# Array of paths
include = [
    "frodo.toml",
    "samwise.toml",
]

# Inline tables for optional paths
include = [
    { path = "required.toml" },
    { path = "optional.toml", optional = true },
]

For complete details, see the Cargo config documentation.

TOML 1.1 Support in Cargo

Rust’s package manager now parses TOML 1.1 for both manifest files (Cargo.toml) and configuration files. This upgrade brings several quality‑of‑life improvements:

  • Inline tables across multiple lines with trailing commas
  • New escape sequences: \xHH (hex byte) and \e (escape character)
  • Optional seconds in times (defaults to 0 if omitted)

For example, a dependency declaration that previously had to be crammed onto one line:

serde = { version = "1.0", features = ["derive"] }

can now be written with a more readable, multi‑line format:

serde = {
    version = "1.0",
    features = ["derive"],
}

Note that using these TOML 1.1 features in Cargo.toml will raise your project’s minimum supported Rust version (MSRV) to require this new Cargo. Check the official TOML 1.1 release notes for a full list of changes.

Other Improvements and Stability Updates

As always, this release includes numerous bug fixes, performance enhancements, and library stabilizations. For the complete list, refer to the detailed release notes for Rust 1.94.0.

Upgrade today with rustup update stable and enjoy the new features!