Rust 1.81 is now available, with the newest version of the memory-safe language, featuring a stabilization of the Error
trait in the Rust core library.
Rust 1.81 was released September 5. Developers with a previous version of Rust installed via rustup
can upgrade using the rustup update stable
command. Developers can install rustup
from the rust-lang.org.
With Rust 1.81, the Error
trait is stabilized in core
, allowing usage of the trait in #![no_std]
libraries. Error
is a trait representing the basic expectations for error values. The stabilization primarily enables the wider Rust ecosystem to standardize on the same Error trait, regardless of the environments targeted by the library. The no_std
attribute allows developers to build Rust applications without using the Rust standard library (std
).
Rust 1.81 also features new and improved sort implementations. Both the stable and the unstable sort implementations in the standard library have been updated to new algorithms that improve compilation time and runtime performance. The new sort algorithms try to detect incorrect implementations of Ord
that prevent these from being able to produce a meaningfully sorted result and will panic on these cases rather than returning randomly arranged data. Users dealing with these panics should audit ordering implementations to ensure they satisfy the requirements documented in PartialOrd
and Ord
.
Rust 1.81 also stabilizes a new lint level, expect
, which allows explicitly noting that a particular lint should occur and warning if it does not. The intended use case is temporarily silencing a lint, whether due to bugs or ongoing refactoring, while wanting to know when the lint is no longer necessary.
Also in Rust 1.81:
- Developers will be informed directly in the compiler message if a lint level is changed for some reason.
- APIs have been stabilized such as
core::error
,fs:exists
,IoSlice::advance
, andPanicHookInfo
. - Usage of the
wasm32-wasi
target, which targets WASI 1.0, now will issue a compiler warning and request users switch to thewasm32-wasip1
target instead. Std::process::Command
now correctly escapes arguments when invoking batch files on Windows in the presence of trailing whitespaces or periods.
Rust 1.81 follows Rust 1.80, released January 25, which introduced lazy types to delay initialization of data until first access.