Software 44179 Published by

Rust 1.94 brings two practical improvements: array_windows for safe, faster slice iteration, and Cargo’s include key that lets teams centralise shared configuration files across projects. Adopting it is as simple as swapping .windows(4) for .array_windows() where you currently destructure windowed slices, or adding an optional include entry to your ~/.cargo/config.toml if you want a tidy way to share dev‑only settings. The new TOML 1.1 parser lets manifests use modern syntax—multiline inline tables, trailing commas, and \xHH escapes—while Cargo automatically rewrites older manifests on publish so that crates keep their MSRV low for downstream users. With array_windows now stable in const contexts and a host of other helpers (LazyCell, LazyLock, SIMD intrinsics, Euler’s constant) stabilized, the compiler feels a bit more powerful without breaking existing code.



Rust 1.94 Adds Array Windows and Cargo Config Includes

Rust 1.94 is out, and it brings a handful of practical tweaks that will shave time off everyday coding chores.

Updating with rustup

If rustup is already on the machine, bump to the new stable by running
rustup update stable. That single command pulls in Rust 1.94 across all toolchains, so any project that relies on cargo run or cargo build will instantly start using the newer language and library features.

Why array_windows matters

The old .windows(4) pattern forces a slice of four bytes to be wrapped as a dynamic &[T]. Every iteration then requires bounds checking, even when the compiler knows the size at compile time. With .array_windows(), the iterator hands back [T; N] directly, eliminating those checks and letting the compiler infer the window length from pattern matching.

Consider an Advent of Code puzzle that scans for “ABBA” patterns in a string. Using the old API, you might write:

s.as_bytes()
 .windows(4)
 .any(|w| w[0] != w[1] && w[0] == w[3] && w[1] == w[2])

A colleague once had that code panic when the input string was shorter than four bytes. Switching to .array_windows() automatically stops iteration before it reaches an out‑of‑bounds slice, and the compiler can inline the checks for a slight speed boost.

Cargo config includes

Cargo now respects an include key in ~/.cargo/config.toml. This lets teams keep common configuration snippets in separate files and pull them into each project’s config on demand. For example:

# ~/.cargo/config.toml
include = [
    { path = "dev.toml", optional = true },
    { path = "ci.toml" }
]

If the dev.toml file is missing, Cargo silently ignores it thanks to the optional flag. This pattern keeps shared settings out of each project’s repo while still allowing local overrides.

TOML 1.1 support in Cargo

Cargo now parses manifests and configuration files using the newer TOML 1.1 spec. The changes are mostly syntactic sugar: multiline inline tables, trailing commas, escaped bytes (\xHH), and optional seconds in timestamps. A typical dependency can be rewritten as:

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

A side effect is that crates using the new syntax bump their Minimum Supported Rust Version (MSRV) to a Cargo that understands TOML 1.1, but Cargo automatically rewrites manifests on cargo publish so downstream projects remain compatible.

Stabilized APIs

Rust 1.94 brings several previously unstable helpers into the stable pool:

  • <[T]>::array_windows and <[T]>::element_offset
  • LazyCell::get, get_mut, force_mut
  • LazyLock::get, get_mut, force_mut
  • impl TryFrom<char> for usize
  • Peekable::next_if_map (and the mutable variant)
  • SIMD intrinsics for AVX512FP16 and AArch64 NEON FP16
  • Constants like f32::consts::EULER_GAMMA

The mul_add family also now works in const contexts, making compile‑time math a little more powerful.

The bottom line

Rust 1.94 gives you safer, faster slice iteration and a cleaner Cargo configuration workflow. The new features are small enough that you can start using them immediately without touching the rest of your codebase—just switch to .array_windows() in places where you previously sliced windows, or add an include entry to share common dev settings.

Announcing Rust 1.94.0 | Rust Blog

Empowering everyone to build reliable and efficient software.

Announcing Rust 1.94.0 | Rust Blog