Series: The Rust Annals
Vol. I Issue 72 nlopes.dev
Announcing Rust 1.71.0
Rust 1.71 defines cross-language unwinding through stable ABI variants while adding substantial debugger, Windows-linking, platform, and standard-library changes.
Rust 1.71 makes cross-language unwinding defined through new -unwind ABI variants, lets libraries embed debugger visualizations, and simplifies bindings to Windows DLLs that are unavailable at build time. It also updates musl to 1.2.3 and documents an earlier stabilization for const-initialized thread locals.
New ABI variants define cross-language unwinding
Rust 1.71 stabilizes C-unwind and other -unwind-suffixed ABI variants. Each is mostly equivalent to the corresponding ABI without -unwind, but defines it to be safe for an unwinding operation—such as a Rust panic or C++ exception—to cross the ABI boundary.
With panic=unwind, an exception can unwind the stack through code in another language without terminating the process, provided it is caught in the language where it originated. With panic=abort, the process will typically abort immediately. The behavior for unforced unwinding, the typical case, is specified in the RFC table; the complete set of stabilized ABIs appears in the stabilization report.
This initial stabilization does not change existing ABIs such as "C": unwinding across them remains undefined behavior. A future release will amend those ABIs to match the RFC, usually aborting at the boundary. Users who need to unwind across an ABI boundary are encouraged to begin using the new unwind variants to remain future proof.
Libraries can carry their own debugger visualizations
The new #[debug_visualizer(natvis_file = "...")] and #[debug_visualizer(gdb_script_file = "...")] attributes let a Rust library embed Natvis descriptions and GDB scripts. These can improve debugger output when users inspect data structures created by the library.
Rust has packaged similar scripts for standard-library types for some time; the stabilized attributes extend that facility to library authors. The reference documents their use.
Windows bindings no longer need DLLs at build time
On Windows, the new kind="raw-dylib" option for #[link] allows Rust code to use functions from dynamic libraries without requiring those libraries to be available at build time. This avoids making users install the libraries—which is particularly difficult during cross-compilation—and removes the need for crates to ship stub libraries solely for linking.
The new #[link_ordinal] attribute also permits bindings to DLL symbols by ordinal rather than by symbol name. Together, these changes simplify crates that provide bindings to Windows libraries.
musl moves to 1.2.3, while const thread-local initialization is documented
As previously announced, Rust 1.71 updates its musl version to 1.2.3. Most users should not be affected.
Rust 1.59.0 had already stabilized const-initialized thread locals in the standard library, allowing more optimal code generation, but the change was omitted from release notes and documentation until now:
use std::cell::Cell;
thread_local! {
pub static FOO: Cell<u32> = const { Cell::new(1) };
}
This earlier stabilization does not make const { ... } a valid expression or syntax in other contexts; that remains a separate, currently unstable feature.
The stabilized array-to-tuple and tuple-to-array conversions apply for N from 1 through 12. The final seven entries in the stabilized API inventory—raw-pointer and ptr reads plus slice splitting—are newly stable in const contexts.