Software 43454 Published by

Rust 1.88.0 represents a stable release of the programming language, enabling users to develop dependable and efficient software solutions. This version includes multiple features, including the capability to chain let statements within if and while conditions, which facilitates a more consistent drop order. Naked functions are now supported, allowing full control over the generated assembly for a particular function. The CFG predicate language has been enhanced to include boolean literals, true and false, which function as configurations that are consistently enabled or disabled, respectively.

The introduction of automatic cache cleaning in version 1.88.0 enables the system to automatically perform garbage collection on the cache located in its home directory. This mechanism eliminates files downloaded from the network that have not been accessed within a 3-month period, as well as files sourced from the local system that remain unaccessed for 1 month. Cargo versions 1.78 and later monitor the access information required for garbage collection; however, certain components continue to exhibit instability.



Announcing Rust 1.88.0

The Rust team is happy to announce a new version of Rust, 1.88.0. Rust is a programming language empowering everyone to build reliable and efficient software.

If you have a previous version of Rust installed via rustup, you can get 1.88.0 with:

$ rustup update stable

If you don't have it already, you can  get rustup from the appropriate page on our website, and check out the  detailed release notes for 1.88.0.

If you'd like to help us out by testing future releases, you might consider updating locally to use the beta channel (rustup default beta) or the nightly channel (rustup default nightly). Please  report any bugs you might come across!

What's in 1.88.0 stable

Let chains

This feature allows &&-chaining let statements inside if and while conditions, even intermingling with boolean expressions, so there is less distinction between if/if let and while/while let. The patterns inside the let sub-expressions can be irrefutable or refutable, and bindings are usable in later parts of the chain as well as the body.

For example, this snippet combines multiple conditions which would have required nesting if let and if blocks before:

if let Channel::Stable(v) = release_info()
    && let Semver { major, minor, .. } = v
    && major == 1
    && minor == 88
{
    println!("`let_chains` was stabilized in this version");
}

Let chains are only available in the Rust 2024 edition, as this feature depends on the  if let temporary scope change for more consistent drop order.

Earlier efforts tried to work with all editions, but some difficult edge cases threatened the integrity of the implementation. 2024 made it feasible, so please upgrade your crate's edition if you'd like to use this feature!

Naked functions

Rust now supports writing naked functions with no compiler-generated epilogue and prologue, allowing full control over the generated assembly for a particular function. This is a more ergonomic alternative to defining functions in a global_asm! block. A naked function is marked with the #[unsafe(naked)] attribute, and its body consists of a single naked_asm! call.

For example:

#[unsafe(naked)]
pub unsafe extern "sysv64" fn wrapping_add(a: u64, b: u64) -> u64 {
    // Equivalent to `a.wrapping_add(b)`.
    core::arch::naked_asm!(
        "lea rax, [rdi + rsi]",
        "ret"
    );
}

The handwritten assembly block defines the entire function body: unlike non-naked functions, the compiler does not add any special handling for arguments or return values. Naked functions are used in low-level settings like Rust's  compiler-builtins, operating systems, and embedded applications.

Look for a more detailed post on this soon!

Boolean configuration

The cfg predicate language now supports boolean literals, true and false, acting as a configuration that is always enabled or disabled, respectively. This works in Rust  conditional compilation with cfg and cfg_attr attributes and the built-in cfg! macro, and also in Cargo [target] tables in both  configuration and  manifests.

Previously, empty predicate lists could be used for unconditional configuration, like cfg(all()) for enabled and cfg(any()) for disabled, but this meaning is rather implicit and easy to get backwards. cfg(true) and cfg(false) offer a more direct way to say what you mean.

See  RFC 3695 for more background!

Cargo automatic cache cleaning

Starting in 1.88.0, Cargo will automatically run garbage collection on the cache in its home directory!

When building, Cargo downloads and caches crates needed as dependencies. Historically, these downloaded files would never be cleaned up, leading to an unbounded amount of disk usage in Cargo's home directory. In this version, Cargo introduces a garbage collection mechanism to automatically clean up old files (e.g. .crate files). Cargo will remove files downloaded from the network if not accessed in 3 months, and files obtained from the local system if not accessed in 1 month. Note that this automatic garbage collection will not take place if running offline (using --offline or --frozen).

Cargo 1.78 and newer track the access information needed for this garbage collection. This was introduced well before the actual cleanup that's starting now, in order to reduce cache churn for those that still use prior versions. If you regularly use versions of Cargo even older than 1.78, in addition to running current versions of Cargo, and you expect to have some crates accessed exclusively by the older versions of Cargo and don't want to re-download those crates every ~3 months, you may wish to set cache.auto-clean-frequency = "never" in the Cargo configuration, as described in the  docs.

For more information, see the original  unstable announcement of this feature. Some parts of that design remain unstable, like the gc subcommand tracked in  cargo#13060, so there's still more to look forward to!

Stabilized APIs

These previously stable APIs are now stable in const contexts:

Other changes

The i686-pc-windows-gnu target has been demoted to Tier 2, as mentioned in an  earlier post. This won't have any immediate effect for users, since both the compiler and standard library tools will still be distributed by rustup for this target. However, with less testing than it had at Tier 1, it has more chance of accumulating bugs in the future.

Check out everything that changed in  Rust Cargo, and  Clippy.

Contributors to 1.88.0

Many people came together to create Rust 1.88.0. We couldn't have done it without all of you.  Thanks!

Announcing Rust 1.88.0 | Rust Blog