Skip to content

Commit e7800f8

Browse files
cuviperMark-Simulacrum
authored andcommitted
Rust 1.76.0 announcement
1 parent 8ed4487 commit e7800f8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

posts/2024-02-08-Rust-1.76.0.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
layout: post
3+
title: "Announcing Rust 1.76.0"
4+
author: The Rust Release Team
5+
release: true
6+
---
7+
8+
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.
9+
10+
If you have a previous version of Rust installed via rustup, you can get 1.76.0 with:
11+
12+
```console
13+
rustup update stable
14+
```
15+
16+
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).
17+
18+
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!
19+
20+
## What's in 1.76.0 stable
21+
22+
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.
23+
24+
### ABI compatibility updates
25+
26+
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.
27+
28+
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.
29+
30+
### Type names from references
31+
32+
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.
33+
34+
```rust
35+
fn get_iter() -> impl Iterator<Item = i32> {
36+
[1, 2, 3].into_iter()
37+
}
38+
39+
fn main() {
40+
let iter = get_iter();
41+
let iter_name = std::any::type_name_of_val(&iter);
42+
let sum: i32 = iter.sum();
43+
println!("The sum of the `{iter_name}` is {sum}.");
44+
}
45+
```
46+
47+
This currently prints:
48+
49+
```text
50+
The sum of the `core::array::iter::IntoIter<i32, 3>` is 6.
51+
```
52+
53+
### Stabilized APIs
54+
55+
- [`Arc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.unwrap_or_clone)
56+
- [`Rc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.unwrap_or_clone)
57+
- [`Result::inspect`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect)
58+
- [`Result::inspect_err`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect_err)
59+
- [`Option::inspect`](https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.inspect)
60+
- [`type_name_of_val`](https://doc.rust-lang.org/stable/std/any/fn.type_name_of_val.html)
61+
- [`std::hash::{DefaultHasher, RandomState}`](https://doc.rust-lang.org/stable/std/hash/index.html#structs)
62+
These were previously available only through `std::collections::hash_map`.
63+
- [`ptr::{from_ref, from_mut}`](https://doc.rust-lang.org/stable/std/ptr/fn.from_ref.html)
64+
- [`ptr::addr_eq`](https://doc.rust-lang.org/stable/std/ptr/fn.addr_eq.html)
65+
66+
### Other changes
67+
68+
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).
69+
70+
## Contributors to 1.76.0
71+
72+
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/)

0 commit comments

Comments
 (0)