Skip to content

Commit 1fdfb9c

Browse files
Mark-Simulacrumjoshtriplettehuss
authored
Add blog post for 1.71 (#1118)
Co-authored-by: Josh Triplett <[email protected]> Co-authored-by: Eric Huss <[email protected]>
1 parent 434179c commit 1fdfb9c

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

posts/2023-07-13-Rust-1.71.0.md

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
layout: post
3+
title: "Announcing Rust 1.71.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.71.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.71.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.71.0](https://github.com/rust-lang/rust/releases/tag/1.71.0) on GitHub.
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.71.0 stable
21+
22+
### C-unwind ABI
23+
24+
1.71.0 stabilizes `C-unwind` (and other `-unwind` suffixed ABI variants[^1]).
25+
26+
The behavior for unforced unwinding (the typical case) is specified in [this
27+
table from the RFC which proposed this feature][rfc-table]. To summarize:
28+
29+
Each ABI is mostly equivalent to the same ABI without `-unwind`, except that
30+
with `-unwind` the behavior is defined to be safe when an unwinding operation
31+
(`panic` or C++ style exception) crosses the ABI boundary. For `panic=unwind`,
32+
this is a valid way to let exceptions from one language unwind the stack in
33+
another language without terminating the process (as long as the exception is
34+
caught in the same language from which it originated); for `panic=abort`, this
35+
will typically abort the process immediately.
36+
37+
For this initial stabilization, *no change* is made to the existing ABIs (e.g.
38+
`"C"`), and unwinding across them remains undefined behavior. A future Rust
39+
release will amend these ABIs to match the behavior specified in the RFC as the
40+
final part in stabilizing this feature (usually aborting at the boundary).
41+
Users are encouraged to start using the new unwind ABI variants in their code
42+
to remain future proof if they need to unwind across the ABI boundary.
43+
44+
### Debugger visualization attributes
45+
46+
1.71.0 stabilizes support for a new attribute, `#[debug_visualizer(natvis_file
47+
= "...")]` and `#[debug_visualizer(gdb_script_file = "...")]`, which allows
48+
embedding Natviz descriptions and GDB scripts into Rust libraries to
49+
improve debugger output when inspecting data structures created by those
50+
libraries. Rust itself has packaged similar scripts for some time for the
51+
standard library, but this feature makes it possible for library authors to
52+
provide a similar experience to end users.
53+
54+
See the [reference](https://doc.rust-lang.org/nightly/reference/attributes/debugger.html#the-debugger_visualizer-attribute)
55+
for details on usage.
56+
57+
### raw-dylib linking
58+
59+
On Windows platforms, Rust now supports using functions from dynamic libraries without requiring those libraries to be available at build time, using the new `kind="raw-dylib”` option for `#[link]`.
60+
61+
This avoids requiring users to install those libraries (particularly difficult for cross-compilation), and avoids having to ship stub versions of libraries in crates to link against. This simplifies crates providing bindings to Windows libraries.
62+
63+
Rust also supports binding to symbols provided by DLLs by ordinal rather than named symbol, using the new `#[link_ordinal]` attribute.
64+
65+
### Upgrade to musl 1.2
66+
67+
As [previously announced](https://blog.rust-lang.org/2023/05/09/Updating-musl-targets.html),
68+
Rust 1.71 updates the musl version to 1.2.3. Most users should not be affected by this change.
69+
70+
### Const-initialized thread locals
71+
72+
Rust 1.59.0 stabilized `const` initialized thread local support in the standard
73+
library, which allows for more optimal code generation. However, until now this
74+
feature was missed in release notes and
75+
[documentation](https://doc.rust-lang.org/stable/std/macro.thread_local.html).
76+
Note that this stabilization does not make `const { ... }` a valid expression
77+
or syntax in other contexts; that is a separate and currently unstable
78+
[feature](https://github.com/rust-lang/rust/issues/76001).
79+
80+
```rust
81+
use std::cell::Cell;
82+
83+
thread_local! {
84+
pub static FOO: Cell<u32> = const { Cell::new(1) };
85+
}
86+
```
87+
88+
### Stabilized APIs
89+
90+
- [`CStr::is_empty`](https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.is_empty)
91+
- [`BuildHasher::hash_one`](https://doc.rust-lang.org/stable/std/hash/trait.BuildHasher.html#method.hash_one)
92+
- [`NonZeroI*::is_positive`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.is_positive)
93+
- [`NonZeroI*::is_negative`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.is_negative)
94+
- [`NonZeroI*::checked_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.checked_neg)
95+
- [`NonZeroI*::overflowing_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.overflowing_neg)
96+
- [`NonZeroI*::saturating_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.saturating_neg)
97+
- [`NonZeroI*::wrapping_neg`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#method.wrapping_neg)
98+
- [`Neg for NonZeroI*`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#impl-Neg-for-NonZeroI32)
99+
- [`Neg for &NonZeroI*`](https://doc.rust-lang.org/stable/std/num/struct.NonZeroI32.html#impl-Neg-for-%26NonZeroI32)
100+
- [`From<[T; N]> for (T...)`](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C%5BT;+1%5D%3E-for-(T,))
101+
(array to N-tuple for N in 1..=12)
102+
- [`From<(T...)> for [T; N]`](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C(T,)%3E-for-%5BT;+1%5D)
103+
(N-tuple to array for N in 1..=12)
104+
- [`windows::io::AsHandle for Box<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsHandle.html#impl-AsHandle-for-Box%3CT%3E)
105+
- [`windows::io::AsHandle for Rc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsHandle.html#impl-AsHandle-for-Rc%3CT%3E)
106+
- [`windows::io::AsHandle for Arc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsHandle.html#impl-AsHandle-for-Arc%3CT%3E)
107+
- [`windows::io::AsSocket for Box<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsSocket.html#impl-AsSocket-for-Box%3CT%3E)
108+
- [`windows::io::AsSocket for Rc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsSocket.html#impl-AsSocket-for-Rc%3CT%3E)
109+
- [`windows::io::AsSocket for Arc<T>`](https://doc.rust-lang.org/stable/std/os/windows/io/trait.AsSocket.html#impl-AsSocket-for-Arc%3CT%3E)
110+
111+
These APIs are now stable in const contexts:
112+
113+
- [`<*const T>::read`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read)
114+
- [`<*const T>::read_unaligned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read_unaligned)
115+
- [`<*mut T>::read`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read-1)
116+
- [`<*mut T>::read_unaligned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.read_unaligned-1)
117+
- [`ptr::read`](https://doc.rust-lang.org/stable/std/ptr/fn.read.html)
118+
- [`ptr::read_unaligned`](https://doc.rust-lang.org/stable/std/ptr/fn.read_unaligned.html)
119+
- [`<[T]>::split_at`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_at)
120+
121+
### Other changes
122+
123+
Check out everything that changed in [Rust](https://github.com/rust-lang/rust/releases/tag/1.71.0), [Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-171-2023-07-13), and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-171).
124+
125+
## Contributors to 1.71.0
126+
127+
Many people came together to create Rust 1.71.0. We couldn't have done it without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.71.0/)
128+
129+
[^1]: List of stabilized ABIs can be found in the stabilization report: https://github.com/rust-lang/rust/issues/74990#issuecomment-1363473645
130+
131+
[rfc-table]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#abi-boundaries-and-unforced-unwinding

0 commit comments

Comments
 (0)