The Rust team is happy to announce a new version of Rust, 1.91.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.91.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.91.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.91.0 stable
aarch64-pc-windows-msvc is now a Tier 1 platform
The Rust compiler supports a wide variety of targets, but the Rust Team can't provide the same level of support for all of them. To clearly mark how supported each target is, we use a tiering system:
- Tier 3 targets are technically supported by the compiler, but we don't check whether their code build or passes the tests, and we don't provide any prebuilt binaries as part of our releases.
- Tier 2 targets are guaranteed to build and we provide prebuilt binaries, but we don't execute the test suite on those platforms: the produced binaries might not work or might have bugs.
- Tier 1 targets provide the highest support guarantee, and we run the full suite on those platforms for every change merged in the compiler. Prebuilt binaries are also available.
Rust 1.91.0 promotes the aarch64-pc-windows-msvc target to Tier 1 support,
bringing our highest guarantees to users of 64-bit ARM systems running Windows.
Add lint against dangling raw pointers from local variables
While Rust's borrow checking prevents dangling references from being returned, it doesn't track raw pointers. With this release, we are adding a warn-by-default lint on raw pointers to local variables being returned from functions. For example, code like this:
will now produce a lint:
warning: a dangling pointer will be produced because the local variable `x` will be dropped
--> src/lib.rs:3:5
|
1 | fn f() -> *const u8 {
| --------- return type of the function is `*const u8`
2 | let x = 0;
| - `x` is part the function and will be dropped at the end of the function
3 | &x
| ^^
|
= note: pointers do not have a lifetime; after returning, the `u8` will be deallocated
at the end of the function because nothing is referencing it as far as the type system is
concerned
= note: `#[warn(dangling_pointers_from_locals)]` on by default
Note that the code above is not unsafe, as it itself doesn't perform any dangerous operations. Only dereferencing the raw pointer after the function returns would be unsafe. We expect future releases of Rust to add more functionality helping authors to safely interact with raw pointers, and with unsafe code more generally.
Stabilized APIs
Path::file_prefixAtomicPtr::fetch_ptr_addAtomicPtr::fetch_ptr_subAtomicPtr::fetch_byte_addAtomicPtr::fetch_byte_subAtomicPtr::fetch_orAtomicPtr::fetch_andAtomicPtr::fetch_xor{integer}::strict_add{integer}::strict_sub{integer}::strict_mul{integer}::strict_div{integer}::strict_div_euclid{integer}::strict_rem{integer}::strict_rem_euclid{integer}::strict_neg{integer}::strict_shl{integer}::strict_shr{integer}::strict_powi{N}::strict_add_unsignedi{N}::strict_sub_unsignedi{N}::strict_absu{N}::strict_add_signedu{N}::strict_sub_signedPanicHookInfo::payload_as_strcore::iter::chainu{N}::checked_signed_diffcore::array::repeatPathBuf::add_extensionPathBuf::with_added_extensionDuration::from_minsDuration::from_hoursimpl PartialEq<str> for PathBufimpl PartialEq<String> for PathBufimpl PartialEq<str> for Pathimpl PartialEq<String> for Pathimpl PartialEq<PathBuf> for Stringimpl PartialEq<Path> for Stringimpl PartialEq<PathBuf> for strimpl PartialEq<Path> for strIpv4Addr::from_octetsIpv6Addr::from_octetsIpv6Addr::from_segmentsimpl<T> Default for Pin<Box<T>> where Box<T>: Default, T: ?Sizedimpl<T> Default for Pin<Rc<T>> where Rc<T>: Default, T: ?Sizedimpl<T> Default for Pin<Arc<T>> where Arc<T>: Default, T: ?SizedCell::as_array_of_cellsu{N}::carrying_addu{N}::borrowing_subu{N}::carrying_mulu{N}::carrying_mul_addBTreeMap::extract_ifBTreeSet::extract_ifimpl Debug for windows::ffi::EncodeWide<'_>str::ceil_char_boundarystr::floor_char_boundaryimpl Sum for Saturating<u{N}>impl Sum<&Self> for Saturating<u{N}>impl Product for Saturating<u{N}>impl Product<&Self> for Saturating<u{N}>
These previously stable APIs are now stable in const contexts:
<[T; N]>::each_ref<[T; N]>::each_mutOsString::newPathBuf::newTypeId::ofptr::with_exposed_provenanceptr::with_exposed_provenance_mut
Platform Support
- Promote
aarch64-pc-windows-msvcto Tier 1 - Promote
aarch64-pc-windows-gnullvmandx86_64-pc-windows-gnullvmto Tier 2 with host tools. Note: llvm-tools and MSI installers are missing but will be added in future releases.
Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Other changes
Check out everything that changed in Rust, Cargo, and Clippy.
Contributors to 1.91.0
Many people came together to create Rust 1.91.0. We couldn't have done it without all of you. Thanks!