The Rust team is happy to announce a new version of Rust, 1.76.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.76.0 with:
$ rustup update stable
If you don't have it already, you can rustup from the appropriate page on our website, and check out the
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
What's in 1.76.0 stable
This release is relatively minor, but as always, even incremental improvements lead to a greater whole. A few of those changes are highlighted in this post, and others may yet fill more niche needs.
ABI compatibility updates
A new
The one new addition is that it is now guaranteed that char and u32 are ABI compatible. They have always had the same size and alignment, but now they are considered equivalent even in function call ABI, consistent with the documentation above.
Type names from references
For debugging purposes, any::type_name::<T>() has been available since Rust 1.38 to return a string description of the type T, but that requires an explicit type parameter. It is not always easy to specify that type, especially for unnameable types like closures or for opaque return types. The new any::type_name_of_val(&T) offers a way to get a descriptive name from any reference to a type.
fn get_iter() -> impl Iterator<Item = i32> {
[1, 2, 3].into_iter()
}
fn main() {
let iter = get_iter();
let iter_name = std::any::type_name_of_val(&iter);
let sum: i32 = iter.sum();
println!("The sum of the `{iter_name}` is {sum}.");
}
This currently prints:
The sum of the `core::array::iter::IntoIter<i32, 3>` is 6.
Stabilized APIs
Arc::unwrap_or_cloneRc::unwrap_or_cloneResult::inspectResult::inspect_errOption::inspecttype_name_of_valstd::hash::{DefaultHasher, RandomState}These were previously available only throughstd::collections::hash_map.ptr::{from_ref, from_mut}ptr::addr_eq
Other changes
Check out everything that changed in
Contributors to 1.76.0
Many people came together to create Rust 1.76.0. We couldn't have done it without all of you.
The Rust Release Team
Also published here
Photo by Jeremy Bishop on Unsplash
