Releases: rust-lang/rust
Rust 1.75.0
Language
- Stabilize
async fn
and return-positionimpl Trait
in traits. - Allow function pointer signatures containing
&mut T
inconst
contexts. - Match
usize
/isize
exhaustively with half-open ranges. - Guarantee that
char
has the same size and alignment asu32
. - Document that the null pointer has the 0 address.
- Allow partially moved values in
match
. - Add notes about non-compliant FP behavior on 32bit x86 targets.
- Stabilize ratified RISC-V target features.
Compiler
- Rework negative coherence to properly consider impls that only partly overlap.
- Bump
COINDUCTIVE_OVERLAP_IN_COHERENCE
to deny, and warn in dependencies. - Consider alias bounds when computing liveness in NLL.
- Add the V (vector) extension to the
riscv64-linux-android
target spec. - Automatically enable cross-crate inlining for small functions
- Add several new tier 3 targets:
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Override
Waker::clone_from
to avoid cloningWaker
s unnecessarily. - Implement
BufRead
forVecDeque<u8>
. - Implement
FusedIterator
forDecodeUtf16
when the inner iterator does. - Implement
Not, Bit{And,Or}{,Assign}
for IP addresses. - Implement
Default
forExitCode
. - Guarantee representation of None in NPO
- Document when atomic loads are guaranteed read-only.
- Broaden the consequences of recursive TLS initialization.
- Windows: Support sub-millisecond sleep.
- Fix generic bound of
str::SplitInclusive
'sDoubleEndedIterator
impl - Fix exit status / wait status on non-Unix
cfg(unix)
platforms.
Stabilized APIs
Atomic*::from_ptr
FileTimes
FileTimesExt
File::set_modified
File::set_times
IpAddr::to_canonical
Ipv6Addr::to_canonical
Option::as_slice
Option::as_mut_slice
pointer::byte_add
pointer::byte_offset
pointer::byte_offset_from
pointer::byte_sub
pointer::wrapping_byte_add
pointer::wrapping_byte_offset
pointer::wrapping_byte_sub
These APIs are now stable in const contexts:
Ipv6Addr::to_ipv4_mapped
MaybeUninit::assume_init_read
MaybeUninit::zeroed
mem::discriminant
mem::zeroed
Cargo
- Add new packages to
[workspace.members]
automatically. - Allow version-less
Cargo.toml
manifests. - Make browser links out of HTML file paths.
Rustdoc
- Accept less invalid Rust in rustdoc.
- Document lack of object safety on affected traits.
- Hide
#[repr(transparent)]
if it isn't part of the public ABI. - Show enum discriminant if it is a C-like variant.
Compatibility Notes
- FreeBSD targets now require at least version 12.
- Formally demote tier 2 MIPS targets to tier 3.
- Make misalignment a hard error in
const
contexts. - Fix detecting references to packed unsized fields.
- Remove support for compiler plugins.
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.74.1
Rust 1.74.0
Language
- Codify that
std::mem::Discriminant<T>
does not depend on any lifetimes in T - Replace
private_in_public
lint withprivate_interfaces
andprivate_bounds
per RFC 2145. Read more in RFC 2145. - Allow explicit
#[repr(Rust)]
- closure field capturing: don't depend on alignment of packed fields
- Enable MIR-based drop-tracking for
async
blocks - Stabilize
impl_trait_projections
Compiler
- stabilize combining +bundle and +whole-archive link modifiers
- Stabilize
PATH
option for--print KIND=PATH
- Enable ASAN/LSAN/TSAN for
*-apple-ios-macabi
- Promote loongarch64-unknown-none* to Tier 2
- Add
i686-pc-windows-gnullvm
as a tier 3 target
Libraries
- Implement
From<OwnedFd/Handle>
for ChildStdin/out/err - Implement
From<{&,&mut} [T; N]>
forVec<T>
whereT: Clone
- impl Step for IP addresses
- Implement
From<[T; N]>
forRc<[T]>
andArc<[T]>
impl TryFrom<char> for u16
- Stabilize
io_error_other
feature - Stabilize the
Saturating
type - Stabilize const_transmute_copy
Stabilized APIs
core::num::Saturating
impl From<io::Stdout> for std::process::Stdio
impl From<io::Stderr> for std::process::Stdio
impl From<OwnedHandle> for std::process::Child{Stdin, Stdout, Stderr}
impl From<OwnedFd> for std::process::Child{Stdin, Stdout, Stderr}
std::ffi::OsString::from_encoded_bytes_unchecked
std::ffi::OsString::into_encoded_bytes
std::ffi::OsStr::from_encoded_bytes_unchecked
std::ffi::OsStr::as_encoded_bytes
std::io::Error::other
impl TryFrom<char> for u16
impl<T: Clone, const N: usize> From<&[T; N]> for Vec<T>
impl<T: Clone, const N: usize> From<&mut [T; N]> for Vec<T>
impl<T, const N: usize> From<[T; N]> for Arc<[T]>
impl<T, const N: usize> From<[T; N]> for Rc<[T]>
These APIs are now stable in const contexts:
Cargo
- In
Cargo.toml
, stabilize[lints]
- Stabilize credential-process and registry-auth
- Stabilize
--keep-going
build flag - Add styling to
--help
output - For
cargo clean
, add--dry-run
flag and summary line at the end - For
cargo update
, make--package
more convenient by being positional - For
cargo update
, clarify meaning of --aggressive as --recursive - Add '-n' as an alias for
--dry-run
- Allow version-prefixes in pkgid's (e.g.
--package
flags) to resolve ambiguities - In
.cargo/config.toml
, merge lists in precedence order - Add support for
target.'cfg(..)'.linker
Rustdoc
- Add warning block support in rustdoc
- rustdoc-search: add support for type parameters
- rustdoc: show inner enum and struct in type definition for concrete type
Compatibility Notes
- Raise minimum supported Apple OS versions
- make Cell::swap panic if the Cells partially overlap
- Reject invalid crate names in
--extern
- Don't resolve generic impls that may be shadowed by dyn built-in impls
- The new
impl From<{&,&mut} [T; N]> for Vec<T>
is known to cause some inference failures with overly-generic code. In those examples using thetui
crate, the combination ofAsRef<_>
andInto<Vec>
leaves the middle type ambiguous, and the newimpl
adds another possibility, so it now requires an explicit type annotation.
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.
None this cycle.
Rust 1.73.0
Language
- Uplift
clippy::fn_null_check
lint asuseless_ptr_null_checks
. - Make
noop_method_call
warn by default. - Support interpolated block for
try
andasync
in macros. - Make
unconditional_recursion
lint detect recursive drops. - Future compatibility warning for some impls being incorrectly considered not overlapping.
- The
invalid_reference_casting
lint is now deny-by-default (instead of allow-by-default)
Compiler
- Write version information in a
.comment
section like GCC/Clang. - Add documentation on v0 symbol mangling.
- Stabilize
extern "thiscall"
and"thiscall-unwind"
ABIs. - Only check outlives goals on impl compared to trait.
- Infer type in irrefutable slice patterns with fixed length as array.
- Discard default auto trait impls if explicit ones exist.
- Add several new tier 3 targets:
- Add
wasm32-wasi-preview1-threads
as a tier 2 target.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Add
Read
,Write
andSeek
impls forArc<File>
. - Merge functionality of
io::Sink
intoio::Empty
. - Implement
RefUnwindSafe
forBacktrace
- Make
ExitStatus
implementDefault
impl SliceIndex<str> for (Bound<usize>, Bound<usize>)
- Change default panic handler message format.
- Cleaner
assert_eq!
&assert_ne!
panic messages. - Correct the (deprecated) Android
stat
struct definitions.
Stabilized APIs
- Unsigned
{integer}::div_ceil
- Unsigned
{integer}::next_multiple_of
- Unsigned
{integer}::checked_next_multiple_of
std::ffi::FromBytesUntilNulError
std::os::unix::fs::chown
std::os::unix::fs::fchown
std::os::unix::fs::lchown
LocalKey::<Cell<T>>::get
LocalKey::<Cell<T>>::set
LocalKey::<Cell<T>>::take
LocalKey::<Cell<T>>::replace
LocalKey::<RefCell<T>>::with_borrow
LocalKey::<RefCell<T>>::with_borrow_mut
LocalKey::<RefCell<T>>::set
LocalKey::<RefCell<T>>::take
LocalKey::<RefCell<T>>::replace
These APIs are now stable in const contexts:
Cargo
Misc
Compatibility Notes
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.
- Remove LLVM pointee types, supporting only opaque pointers.
- Port PGO/LTO/BOLT optimized build pipeline to Rust.
- Replace in-tree
rustc_apfloat
with the new version of the crate. - Update to LLVM 17.
- Add
internal_features
lint for internal unstable features. - Mention style for new syntax in tracking issue template.
Rust 1.72.1
- Adjust codegen change to improve LLVM codegen
- rustdoc: Fix self ty params in objects with lifetimes
- Fix regression in compile times
- Resolve some ICE regressions in the compiler:
Rust 1.72.0
Language
- Replace const eval limit by a lint and add an exponential backoff warning
- expand: Change how
#![cfg(FALSE)]
behaves on crate root - Stabilize inline asm for LoongArch64
- Uplift
clippy::undropped_manually_drops
lint - Uplift
clippy::invalid_utf8_in_unchecked
lint asinvalid_from_utf8_unchecked
andinvalid_from_utf8
- Uplift
clippy::cast_ref_to_mut
lint asinvalid_reference_casting
- Uplift
clippy::cmp_nan
lint asinvalid_nan_comparisons
- resolve: Remove artificial import ambiguity errors
- Don't require associated types with Self: Sized bounds in
dyn Trait
objects
Compiler
- Remember names of
cfg
-ed out items to mention them in diagnostics - Support for native WASM exceptions
- Add support for NetBSD/aarch64-be (big-endian arm64).
- Write to stdout if
-
is given as output file - Force all native libraries to be statically linked when linking a static binary
- Add Tier 3 support for
loongarch64-unknown-none*
- Prevent
.eh_frame
from being emitted for-C panic=abort
- Support 128-bit enum variant in debuginfo codegen
- compiler: update solaris/illumos to enable tsan support.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Document memory orderings of
thread::{park, unpark}
- io: soften ‘at most one write attempt’ requirement in io::Write::write
- Specify behavior of HashSet::insert
- Relax implicit
T: Sized
bounds onBufReader<T>
,BufWriter<T>
andLineWriter<T>
- Update runtime guarantee for
select_nth_unstable
- Return
Ok
on kill if process has already exited - Implement PartialOrd for
Vec
s over different allocators - Use 128 bits for TypeId hash
- Don't drain-on-drop in DrainFilter impls of various collections.
- Make
{Arc,Rc,Weak}::ptr_eq
ignore pointer metadata
Rustdoc
- Allow whitespace as path separator like double colon
- Add search result item types after their name
- Search for slices and arrays by type with
[]
- Clean up type unification and "unboxing"
Stabilized APIs
These APIs are now stable in const contexts:
Cargo
- Enable
-Zdoctest-in-workspace
by default. When running each documentation test, the working directory is set to the root directory of the package the test belongs to. docs #12221 #12288 - Add support of the "default" keyword to reset previously set
build.jobs
parallelism back to the default. #12222
Compatibility Notes
- Alter
Display
forIpv6Addr
for IPv4-compatible addresses - Cargo changed feature name validation check to a hard error. The warning was added in Rust 1.49. These extended characters aren't allowed on crates.io, so this should only impact users of other registries, or people who don't publish to a registry. #12291
- Demoted
mips*-unknown-linux-gnu*
targets from host tier 2 to target tier 3 support.
Rust 1.71.1
- 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_op
lint when callingborrow()
- Fix ICE: substitute types before checking inlining compatibility
- Fix ICE: don't use
can_eq
inderive(..)
suggestion for missing method - Fix building Rust 1.71.0 from the source tarball
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.