-
Notifications
You must be signed in to change notification settings - Fork 306
Rust 1.76.0 announcement #1243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Rust 1.76.0 announcement #1243
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
layout: post | ||
title: "Announcing Rust 1.76.0" | ||
author: The Rust Release Team | ||
release: true | ||
--- | ||
|
||
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: | ||
|
||
```console | ||
rustup update stable | ||
``` | ||
|
||
If you don't have it already, you can [get `rustup`](https://www.rust-lang.org/install.html) from the appropriate page on our website, and check out the [detailed release notes for 1.76.0](https://doc.rust-lang.org/nightly/releases.html#version-1760-2024-02-08). | ||
|
||
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](https://github.com/rust-lang/rust/issues/new/choose) any bugs you might come across! | ||
|
||
## 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 [ABI Compatibility](https://doc.rust-lang.org/stable/std/primitive.fn.html#abi-compatibility) section in the function pointer documentation describes what it means for function signatures to be ABI-compatible. A large part of that is the compatibility of argument types and return types, with a list of those that are currently considered compatible in Rust. For the most part, this documentation is not adding any new guarantees, only describing the existing state of compatibility. | ||
|
||
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>()`](https://doc.rust-lang.org/stable/std/any/fn.type_name.html) 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 `type_name_of_val(&T)` offers a way to get a descriptive name from any reference to a type. | ||
|
||
```rust | ||
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: | ||
|
||
```text | ||
The sum of the `core::array::iter::IntoIter<i32, 3>` is 6. | ||
``` | ||
|
||
### Stabilized APIs | ||
|
||
- [`Arc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.unwrap_or_clone) | ||
- [`Rc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.unwrap_or_clone) | ||
- [`Result::inspect`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect) | ||
- [`Result::inspect_err`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect_err) | ||
- [`Option::inspect`](https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.inspect) | ||
- [`type_name_of_val`](https://doc.rust-lang.org/stable/std/any/fn.type_name_of_val.html) | ||
- [`std::hash::{DefaultHasher, RandomState}`](https://doc.rust-lang.org/stable/std/hash/index.html#structs) | ||
These were previously available only through `std::collections::hash_map`. | ||
- [`ptr::{from_ref, from_mut}`](https://doc.rust-lang.org/stable/std/ptr/fn.from_ref.html) | ||
- [`ptr::addr_eq`](https://doc.rust-lang.org/stable/std/ptr/fn.addr_eq.html) | ||
|
||
### Other changes | ||
|
||
Check out everything that changed in [Rust](https://github.com/rust-lang/rust/releases/tag/1.76.0), [Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-176-2024-02-08), and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-176). | ||
|
||
## 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. [Thanks!](https://thanks.rust-lang.org/rust/1.76.0/) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.