Rust versions / 1.71
Rust release · Jul 13, 2023
Rust 1.71: what's new, what was stabilized
Short answerRust 1.71 was released on Jul 13, 2023: 1 language stabilization (Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool.); 25 newly stable APIs (CStr::is_empty, BuildHasher::hash_one, NonZeroI*::is_positive, NonZeroI*::is_negative, ...); 5 compatibility notes that can affect existing code. Point release: 1.71.1 (Aug 3, 2023).
← Rust 1.70All versionsRust 1.72 →
Language features stabilized
- Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool.
25 APIs stabilized
CStr::is_empty, BuildHasher::hash_one, NonZeroI*::is_positive, NonZeroI*::is_negative, NonZeroI*::checked_neg, NonZeroI*::overflowing_neg, NonZeroI*::saturating_neg, NonZeroI*::wrapping_neg, Neg for NonZeroI*, Neg for &NonZeroI*, From<[T; N]> for , From<, windows::io::AsHandle for Box<T>, windows::io::AsHandle for Rc<T>, windows::io::AsHandle for Arc<T>, windows::io::AsSocket for Box<T>, windows::io::AsSocket for Rc<T>, windows::io::AsSocket for Arc<T>, <*const T>::read, <*const T>::read_unaligned, <*mut T>::read, <*mut T>::read_unaligned, ptr::read, ptr::read_unaligned, <[T]>::split_at
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- Remove structural match from
TypeId. - Add a
sysrootcrate to represent the standard library crates. - Cargo optimizes its usage under
rustup. When - [When querying a package, Cargo tries only the original name, all hyphens, and all underscores to
- Cargo now disallows
RUSTUP_HOMEand
Use it
rustup update stable # get the newest release
rustup install 1.71 # or exactly this one
rustup override set 1.71 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.71" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- Stabilize
raw-dylib,link_ordinal,import_name_typeand-Cdlltool. - Uplift
clippy::{drop,forget}_{ref,copy}lints. - Type inference is more conservative around constrained vars.
- Use fulfillment to check
Dropimpl compatibility
<a id="1.71.0-Compiler"></a>
Compiler
- Evaluate place expression in
PlaceMention, makinglet _ =patterns more consistent with respect to the borrow checker. - Add
--print deployment-targetflag for Apple targets. - Stabilize
extern "C-unwind"and friends. The existingextern "C"etc. may change behavior for cross-language unwinding in a future release. - Update the version of musl used on
*-linux-musltargets to 1.2.3, enabling time64 on 32-bit systems. - Stabilize
debugger_visualizerfor embedding metadata like Microsoft's Natvis. - Enable flatten-format-args by default.
- Make
Selfrespect tuple constructor privacy. - Improve niche placement by trying two strategies and picking the better result.
- Use
apple-m1as the target CPU foraarch64-apple-darwin. - Add Tier 3 support for the
x86_64h-apple-darwintarget. - Promote
loongarch64-unknown-linux-gnuto Tier 2 with host tools.
Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
<a id="1.71.0-Libraries"></a>
Libraries
- Rework handling of recursive panics. Additional panics are allowed while unwinding, as long as they are caught before escaping a
Dropimplementation, but panicking within a panic hook is now an immediate abort. - [Loosen
From<&[T]> for Box<[T]>bound toT: Clone.](https://github.com/rust-lang/rust/pull/103406/) - Remove unnecessary
T: Sendbound inError for mpsc::SendError<T>andTrySendError<T>. - Fix docs for
alloc::reallocto matchLayoutrequirements that the size must not exceedisize::MAX. - Document
const {}syntax forstd::thread_local. This syntax was stabilized in Rust 1.59, but not previously mentioned in release notes.
<a id="1.71.0-Stabilized-APIs"></a>
Stabilized APIs
CStr::is_emptyBuildHasher::hash_oneNonZeroI*::is_positiveNonZeroI*::is_negativeNonZeroI*::checked_negNonZeroI*::overflowing_negNonZeroI*::saturating_negNonZeroI*::wrapping_negNeg for NonZeroI*Neg for &NonZeroI*- [
From<[T; N]> for (T...)](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C%5BT;+1%5D%3E-for-(T,)) (array to N-tuple for N in 1..=12) - [
From<(T...)> for [T; N]](https://doc.rust-lang.org/stable/std/primitive.array.html#impl-From%3C(T,)%3E-for-%5BT;+1%5D) (N-tuple to array for N in 1..=12) windows::io::AsHandle for Box<T>windows::io::AsHandle for Rc<T>windows::io::AsHandle for Arc<T>windows::io::AsSocket for Box<T>windows::io::AsSocket for Rc<T>windows::io::AsSocket for Arc<T>
These APIs are now stable in const contexts:
<*const T>::read<*const T>::read_unaligned<*mut T>::read<*mut T>::read_unalignedptr::readptr::read_unaligned- [
<[T]>::split_at](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_at)
<a id="1.71.0-Cargo"></a>
Cargo
- Allow named debuginfo options in
Cargo.toml. - Add
workspace_default_membersto the output ofcargo metadata. - Automatically inherit workspace fields when running
cargo new/cargo init.
<a id="1.71.0-Rustdoc"></a>
Rustdoc
- Add a new
rustdoc::unescaped_backtickslint for broken inline code. - Support strikethrough with single tildes. (
~~old~~vs.~new~)
<a id="1.71.0-Misc"></a>
Misc
<a id="1.71.0-Compatibility-Notes"></a>
Compatibility Notes
- Remove structural match from
TypeId. Code that uses a constantTypeIdin a pattern will potentially be broken. Known cases have already been fixed -- in particular, users of thelogcrate'skv_unstablefeature should update tolog v0.4.18or later. - Add a
sysrootcrate to represent the standard library crates. This does not affect stable users, but may require adjustment in tools that build their own standard library. - Cargo optimizes its usage under
rustup. When Cargo detects it will runrustcpointing to a rustup proxy, it'll try bypassing the proxy and use the underlying binary directly. There are assumptions around the interaction with rustup andRUSTUP_TOOLCHAIN. However, it's not expected to affect normal users. - When querying a package, Cargo tries only the original name, all hyphens, and all underscores to handle misspellings. Previously, Cargo tried each combination of hyphens and underscores, causing excessive requests to crates.io.
- Cargo now disallows
RUSTUP_HOMEandRUSTUP_TOOLCHAINin the[env]configuration table. This is considered to be not a use case Cargo would like to support, since it will likely cause problems or lead to confusion.
<a id="1.71.0-Internal-Changes"></a>
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
1.71.1 (Aug 3, 2023)
- Fix CVE-2023-38497: Cargo did not respect the umask when extracting dependencies
- Fix bash completion for users of Rustup
- Do not show
suspicious_double_ref_oplint when callingborrow() - Fix ICE: substitute types before checking inlining compatibility
- Fix ICE: don't use
can_eqinderive(..)suggestion for missing method - Fix building Rust 1.71.0 from the source tarball
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.72Released Aug 24, 2023.Read it next →Also worth your time
Did this answer your question?