Releases: rust-lang/rust
Rust 1.71.0
Language
- Stabilize
raw-dylib
,link_ordinal
,import_name_type
and-Cdlltool
. - Uplift
clippy::{drop,forget}_{ref,copy}
lints. - Type inference is more conservative around constrained vars.
- Use fulfillment to check
Drop
impl compatibility
Compiler
- Evaluate place expression in
PlaceMention
, makinglet _ =
patterns more consistent with respect to the borrow checker. - Add
--print deployment-target
flag 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-musl
targets to 1.2.3, enabling time64 on 32-bit systems. - Stabilize
debugger_visualizer
for embedding metadata like Microsoft's Natvis. - Enable flatten-format-args by default.
- Make
Self
respect tuple constructor privacy. - Improve niche placement by trying two strategies and picking the better result.
- Use
apple-m1
as the target CPU foraarch64-apple-darwin
. - Add Tier 3 support for the
x86_64h-apple-darwin
target. - Promote
loongarch64-unknown-linux-gnu
to Tier 2 with host tools.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Rework handling of recursive panics. Additional panics are allowed while unwinding, as long as they are caught before escaping a
Drop
implementation, but panicking within a panic hook is now an immediate abort. - Loosen
From<&[T]> for Box<[T]>
bound toT: Clone
. - Remove unnecessary
T: Send
bound inError for mpsc::SendError<T>
andTrySendError<T>
. - Fix docs for
alloc::realloc
to matchLayout
requirements 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.
Stabilized APIs
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 (T...)
(array to N-tuple for N in 1..=12)From<(T...)> for [T; N]
(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_unaligned
ptr::read
ptr::read_unaligned
<[T]>::split_at
Cargo
- Allow named debuginfo options in
Cargo.toml
. - Add
workspace_default_members
to the output ofcargo metadata
. - Automatically inherit workspace fields when running
cargo new
/cargo init
.
Rustdoc
- Add a new
rustdoc::unescaped_backticks
lint for broken inline code. - Support strikethrough with single tildes. (
~~old~~
vs.~new~
)
Misc
Compatibility Notes
- Remove structural match from
TypeId
. Code that uses a constantTypeId
in a pattern will potentially be broken. Known cases have already been fixed -- in particular, users of thelog
crate'skv_unstable
feature should update tolog v0.4.18
or later. - Add a
sysroot
crate 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 runrustc
pointing 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_HOME
andRUSTUP_TOOLCHAIN
in 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.
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.
Rust 1.70.0
Language
- Relax ordering rules for
asm!
operands - Properly allow macro expanded
format_args
invocations to uses captures - Lint ambiguous glob re-exports
- Perform const and unsafe checking for expressions in
let _ = expr
position.
Compiler
- Extend -Cdebuginfo with new options and named aliases This provides a smaller version of debuginfo for cases that only need line number information (
-Cdebuginfo=line-tables-only
), which may eventually become the default for-Cdebuginfo=1
. - Make
unused_allocation
lint againstBox::new
too - Detect uninhabited types early in const eval
- Switch to LLD as default linker for {arm,thumb}v4t-none-eabi
- Add tier 3 target
loongarch64-unknown-linux-gnu
- Add tier 3 target for
i586-pc-nto-qnx700
(QNX Neutrino RTOS, version 7.0), - Insert alignment checks for pointer dereferences as debug assertions This catches undefined behavior at runtime, and may cause existing code to fail.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Document NonZeroXxx layout guarantees
- Windows: make
Command
prefer non-verbatim paths - Implement Default for some alloc/core iterators
- Fix handling of trailing bare CR in str::lines
- allow negative numeric literals in
concat!
- Add documentation about the memory layout of
Cell
- Use
partial_cmp
to implement tuplelt
/le
/ge
/gt
- Stabilize
atomic_as_ptr
- Stabilize
nonnull_slice_from_raw_parts
- Partial stabilization of
once_cell
- Stabilize
nonzero_min_max
- Flatten/inline format_args!() and (string and int) literal arguments into format_args!()
- Stabilize movbe target feature
- don't splice from files into pipes in io::copy
- Add a builtin unstable
FnPtr
trait that is implemented for all function pointers This extendsDebug
,Pointer
,Hash
,PartialEq
,Eq
,PartialOrd
, andOrd
implementations for function pointers with all ABIs.
Stabilized APIs
NonZero*::MIN/MAX
BinaryHeap::retain
Default for std::collections::binary_heap::IntoIter
Default for std::collections::btree_map::{IntoIter, Iter, IterMut}
Default for std::collections::btree_map::{IntoKeys, Keys}
Default for std::collections::btree_map::{IntoValues, Values}
Default for std::collections::btree_map::Range
Default for std::collections::btree_set::{IntoIter, Iter}
Default for std::collections::btree_set::Range
Default for std::collections::linked_list::{IntoIter, Iter, IterMut}
Default for std::vec::IntoIter
Default for std::iter::Chain
Default for std::iter::Cloned
Default for std::iter::Copied
Default for std::iter::Enumerate
Default for std::iter::Flatten
Default for std::iter::Fuse
Default for std::iter::Rev
Default for std::slice::Iter
Default for std::slice::IterMut
Rc::into_inner
Arc::into_inner
std::cell::OnceCell
Option::is_some_and
NonNull::slice_from_raw_parts
Result::is_ok_and
Result::is_err_and
std::sync::atomic::Atomic*::as_ptr
std::io::IsTerminal
std::os::linux::net::SocketAddrExt
std::os::unix::net::UnixDatagram::bind_addr
std::os::unix::net::UnixDatagram::connect_addr
std::os::unix::net::UnixDatagram::send_to_addr
std::os::unix::net::UnixListener::bind_addr
std::path::Path::as_mut_os_str
std::sync::OnceLock
Cargo
- Add
CARGO_PKG_README
- Make
sparse
the default protocol for crates.io - Accurately show status when downgrading dependencies
- Use registry.default for login/logout
- Stabilize
cargo logout
Misc
Compatibility Notes
- Prevent stable
libtest
from supporting-Zunstable-options
- Perform const and unsafe checking for expressions in
let _ = expr
position. - WebAssembly targets enable
sign-ext
andmutable-globals
features in codegen This may cause incompatibility with older execution environments. - Insert alignment checks for pointer dereferences as debug assertions This catches undefined behavior at runtime, and may cause existing code to fail.
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.
Rust 1.69.0
Language
- Deriving built-in traits on packed structs works with
Copy
fields. - Stabilize the
cmpxchg16b
target feature on x86 and x86_64. - Improve analysis of trait bounds for associated types.
- Allow associated types to be used as union fields.
- Allow
Self: Autotrait
bounds on dyn-safe trait methods. - Treat
str
as containing[u8]
for auto trait purposes.
Compiler
- Upgrade
*-pc-windows-gnu
on CI to mingw-w64 v10 and GCC 12.2. - Rework min_choice algorithm of member constraints.
- Support
true
andfalse
as boolean flags in compiler arguments. - Default
repr(C)
enums toc_int
size.
Libraries
- Implement the unstable
DispatchFromDyn
for cell types, allowing downstream experimentation with custom method receivers. - Document that
fmt::Arguments::as_str()
may returnSome(_)
in more cases after optimization, subject to change. - Implement
AsFd
andAsRawFd
forRc
.
Stabilized APIs
These APIs are now stable in const contexts:
SocketAddr::new
SocketAddr::ip
SocketAddr::port
SocketAddr::is_ipv4
SocketAddr::is_ipv6
SocketAddrV4::new
SocketAddrV4::ip
SocketAddrV4::port
SocketAddrV6::new
SocketAddrV6::ip
SocketAddrV6::port
SocketAddrV6::flowinfo
SocketAddrV6::scope_id
Cargo
- Cargo now suggests
cargo fix
orcargo clippy --fix
when compilation warnings are auto-fixable. - Cargo now suggests
cargo add
if you try to install a library crate. - Cargo now sets the
CARGO_BIN_NAME
environment variable also for binary examples.
Rustdoc
- Vertically compact trait bound formatting.
- Only include stable lints in
rustdoc::all
group. - Compute maximum Levenshtein distance based on the query.
- Remove inconsistently-present sidebar tooltips.
- Search by macro when query ends with
!
.
Compatibility Notes
- The
rust-analysis
component fromrustup
now only contains a warning placeholder. This was primarily intended for RLS, and the corresponding-Zsave-analysis
flag has been removed from the compiler as well. - Unaligned references to packed fields are now a hard error. This has been a warning since 1.53, and denied by default with a future-compatibility warning since 1.62.
- Update the minimum external LLVM to 14.
- Cargo now emits errors on invalid characters in a registry token.
- When
default-features
is set to false of a workspace dependency, and an inherited dependency of a member hasdefault-features = true
, Cargo will enable default features of that dependency. - Cargo denies
CARGO_HOME
in the[env]
configuration table. Cargo itself doesn't pick up this value, but recursive calls to cargo would, which was not intended. - Debuginfo for build dependencies is now off if not explicitly set. This is expected to improve the overall build time.
- The Rust distribution no longer always includes rustdoc If
tools = [...]
is set in config.toml, we will respect a missing rustdoc in that list. By default rustdoc remains included. To retain the prior behavior explicitly add"rustdoc"
to the list.
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.
Rust 1.68.2
- Update the GitHub RSA host key bundled within Cargo. The key was rotated by GitHub on 2023-03-24 after the old one leaked.
- Mark the old GitHub RSA host key as revoked. This will prevent Cargo from accepting the leaked key even when trusted by the system.
- Add support for
@revoked
and a better error message for@cert-authority
in Cargo's SSH host key verification
Rust 1.68.1
- Fix miscompilation in produced Windows MSVC artifacts This was introduced by enabling ThinLTO for the distributed rustc which led to miscompilations in the resulting binary. Currently this is believed to be limited to the -Zdylib-lto flag used for rustc compilation, rather than a general bug in ThinLTO, so only rustc artifacts should be affected.
- Fix --enable-local-rust builds
- Treat
$prefix-clang
asclang
in linker detection code - Fix panic in compiler code
Rust 1.68.0
Language
- Stabilize default_alloc_error_handler This allows usage of
alloc
on stable without requiring the definition of a handler for allocation failure. Defining custom handlers is still unstable. - Stabilize
efiapi
calling convention. - Remove implicit promotion for types with drop glue
Compiler
- Change
bindings_with_variant_name
to deny-by-default - Allow .. to be parsed as let initializer
- Add
armv7-sony-vita-newlibeabihf
as a tier 3 target - Always check alignment during compile-time const evaluation
- Disable "split dwarf inlining" by default.
- Add vendor to Fuchsia's target triple
- Enable sanitizers for s390x-linux
Libraries
- Loosen the bound on the Debug implementation of Weak.
- Make
std::task::Context
!Send and !Sync - PhantomData layout guarantees
- Don't derive Debug for
OnceWith
&RepeatWith
- Implement DerefMut for PathBuf
- Add O(1)
Vec -> VecDeque
conversion guarantee - Leak amplification for peek_mut() to ensure BinaryHeap's invariant is always met
Stabilized APIs
{core,std}::pin::pin!
impl From<bool> for {f32,f64}
std::path::MAIN_SEPARATOR_STR
impl DerefMut for PathBuf
These APIs are now stable in const contexts:
Cargo
- Stabilize sparse registry support for crates.io
cargo build --verbose
tells you more about why it recompiles.- Show progress of crates.io index update even
net.git-fetch-with-cli
option enabled
Misc
Compatibility Notes
- Only support Android NDK 25 or newer
- Add
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS
to future-incompat report - Only specify
--target
by default for-Zgcc-ld=lld
on wasm - Bump
IMPLIED_BOUNDS_ENTAILMENT
to Deny + ReportNow std::task::Context
no longer implements Send and Sync
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.
- Encode spans relative to the enclosing item
- Don't normalize in AstConv
- Find the right lower bound region in the scenario of partial order relations
- Fix impl block in const expr
- Check ADT fields for copy implementations considering regions
- rustdoc: simplify JS search routine by not messing with lev distance
- Enable ThinLTO for rustc on
x86_64-pc-windows-msvc
- Enable ThinLTO for rustc on
x86_64-apple-darwin
Rust 1.67.1
Rust 1.67.0
Language
- Make
Sized
predicates coinductive, allowing cycles. #[must_use]
annotations onasync fn
also affect theFuture::Output
.- Elaborate supertrait obligations when deducing closure signatures.
- Invalid literals are no longer an error under
cfg(FALSE)
. - Unreserve braced enum variants in value namespace.
Compiler
- Enable varargs support for calling conventions other than
C
orcdecl
. - Add new MIR constant propagation based on dataflow analysis.
- Optimize field ordering by grouping m*2^n-sized fields with equivalently aligned ones.
- Stabilize native library modifier
verbatim
.
Added, updated, and removed targets:
- Add a tier 3 target for PowerPC on AIX,
powerpc64-ibm-aix
. - Add a tier 3 target for the Sony PlayStation 1,
mipsel-sony-psx
. - Add tier 3
no_std
targets for the QNX Neutrino RTOS,aarch64-unknown-nto-qnx710
andx86_64-pc-nto-qnx710
. - Promote UEFI targets to tier 2,
aarch64-unknown-uefi
,i686-unknown-uefi
, andx86_64-unknown-uefi
. - Remove tier 3
linuxkernel
targets (not used by the actual kernel).
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Merge
crossbeam-channel
intostd::sync::mpsc
. - Fix inconsistent rounding of 0.5 when formatted to 0 decimal places.
- Derive
Eq
andHash
forControlFlow
. - Don't build
compiler_builtins
with-C panic=abort
.
Stabilized APIs
{integer}::checked_ilog
{integer}::checked_ilog2
{integer}::checked_ilog10
{integer}::ilog
{integer}::ilog2
{integer}::ilog10
NonZeroU*::ilog2
NonZeroU*::ilog10
NonZero*::BITS
These APIs are now stable in const contexts:
Compatibility Notes
- The layout of
repr(Rust)
types now groups m*2^n-sized fields with equivalently aligned ones. This is intended to be an optimization, but it is also known to increase type sizes in a few cases for the placement of enum tags. As a reminder, the layout ofrepr(Rust)
types is an implementation detail, subject to change. - 0.5 now rounds to 0 when formatted to 0 decimal places. This makes it consistent with the rest of floating point formatting that rounds ties toward even digits.
- Chains of
&&
and||
will now drop temporaries from their sub-expressions in evaluation order, left-to-right. Previously, it was "twisted" such that the first expression dropped its temporaries last, after all of the other expressions dropped in order. - Underscore suffixes on string literals are now a hard error. This has been a future-compatibility warning since 1.20.0.
- Stop passing
-export-dynamic
towasm-ld
. main
is now mangled as__main_void
onwasm32-wasi
.- Cargo now emits an error if there are multiple registries in the configuration with the same index URL.
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.
Rust 1.66.1
- Added validation of SSH host keys for git URLs in Cargo (CVE-2022-46176)
Rust 1.66.1
- Added validation of SSH host keys for git URLs in Cargo (CVE-2022-46176)