Releases: rust-lang/rust
Rust 1.76.0
Language
- Document Rust ABI compatibility between various types
- Also: guarantee that char and u32 are ABI-compatible
- Add lint
ambiguous_wide_pointer_comparisonsthat supersedesclippy::vtable_address_comparisons
Compiler
- Lint pinned
#[must_use]pointers (in particular,Box<T>whereTis#[must_use]) inunused_must_use. - Soundness fix: fix computing the offset of an unsized field in a packed struct
- Soundness fix: fix dynamic size/align computation logic for packed types with dyn Trait tail
- Add
$message_typefield to distinguish json diagnostic outputs - Enable Rust to use the EHCont security feature of Windows
- Add tier 3 {x86_64,i686}-win7-windows-msvc targets
- Add tier 3 aarch64-apple-watchos target
- Add tier 3 arm64e-apple-ios & arm64e-apple-darwin targets
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Add a column number to
dbg!() - Add
std::hash::{DefaultHasher, RandomState}exports - Fix rounding issue with exponents in fmt
- Add T: ?Sized to
RwLockReadGuardandRwLockWriteGuard's Debug impls. - Windows: Allow
File::createto work on hidden files
Stabilized APIs
Arc::unwrap_or_cloneRc::unwrap_or_cloneResult::inspectResult::inspect_errOption::inspecttype_name_of_valstd::hash::{DefaultHasher, RandomState}These were previously available only throughstd::collections::hash_map.ptr::{from_ref, from_mut}ptr::addr_eq
Cargo
See Cargo release notes.
Rustdoc
- Don't merge cfg and doc(cfg) attributes for re-exports
- rustdoc: allow resizing the sidebar / hiding the top bar
- rustdoc-search: add support for traits and associated types
- rustdoc: Add highlighting for comments in items declaration
Compatibility Notes
- Add allow-by-default lint for unit bindings This is expected to be upgraded to a warning by default in a future Rust release. Some macros emit bindings with type
()with user-provided spans, which means that this lint will warn for user code. - Remove x86_64-sun-solaris target.
- Remove asmjs-unknown-emscripten target
- Report errors in jobserver inherited through environment variables This may warn on benign problems too.
- Update the minimum external LLVM to 16.
- Improve
print_ttsThis change can break some naive manual parsing of token trees in proc macro code which expect a particular structure after.to_string(), rather than just arbitrary Rust code. - Make
IMPLIED_BOUNDS_ENTAILMENTinto a hard error from a lint - Vec's allocation behavior was changed when collecting some iterators Allocation behavior is currently not specified, nevertheless changes can be surprising. See
impl FromIterator for Vecfor more details. - Properly reject
defaulton free const items
Rust 1.75.0
Language
- Stabilize
async fnand return-positionimpl Traitin traits. - Allow function pointer signatures containing
&mut Tinconstcontexts. - Match
usize/isizeexhaustively with half-open ranges. - Guarantee that
charhas 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_COHERENCEto deny, and warn in dependencies. - Consider alias bounds when computing liveness in NLL.
- Add the V (vector) extension to the
riscv64-linux-androidtarget 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_fromto avoid cloningWakers unnecessarily. - Implement
BufReadforVecDeque<u8>. - Implement
FusedIteratorforDecodeUtf16when the inner iterator does. - Implement
Not, Bit{And,Or}{,Assign}for IP addresses. - Implement
DefaultforExitCode. - 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'sDoubleEndedIteratorimpl - Fix exit status / wait status on non-Unix
cfg(unix)platforms.
Stabilized APIs
Atomic*::from_ptrFileTimesFileTimesExtFile::set_modifiedFile::set_timesIpAddr::to_canonicalIpv6Addr::to_canonicalOption::as_sliceOption::as_mut_slicepointer::byte_addpointer::byte_offsetpointer::byte_offset_frompointer::byte_subpointer::wrapping_byte_addpointer::wrapping_byte_offsetpointer::wrapping_byte_sub
These APIs are now stable in const contexts:
Ipv6Addr::to_ipv4_mappedMaybeUninit::assume_init_readMaybeUninit::zeroedmem::discriminantmem::zeroed
Cargo
- Add new packages to
[workspace.members]automatically. - Allow version-less
Cargo.tomlmanifests. - 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
constcontexts. - 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_publiclint withprivate_interfacesandprivate_boundsper 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
asyncblocks - Stabilize
impl_trait_projections
Compiler
- stabilize combining +bundle and +whole-archive link modifiers
- Stabilize
PATHoption for--print KIND=PATH - Enable ASAN/LSAN/TSAN for
*-apple-ios-macabi - Promote loongarch64-unknown-none* to Tier 2
- Add
i686-pc-windows-gnullvmas 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_otherfeature - Stabilize the
Saturatingtype - Stabilize const_transmute_copy
Stabilized APIs
core::num::Saturatingimpl From<io::Stdout> for std::process::Stdioimpl From<io::Stderr> for std::process::Stdioimpl 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_uncheckedstd::ffi::OsString::into_encoded_bytesstd::ffi::OsStr::from_encoded_bytes_uncheckedstd::ffi::OsStr::as_encoded_bytesstd::io::Error::otherimpl TryFrom<char> for u16impl<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-goingbuild flag - Add styling to
--helpoutput - For
cargo clean, add--dry-runflag and summary line at the end - For
cargo update, make--packagemore 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.
--packageflags) 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 thetuicrate, the combination ofAsRef<_>andInto<Vec>leaves the middle type ambiguous, and the newimpladds 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_checklint asuseless_ptr_null_checks. - Make
noop_method_callwarn by default. - Support interpolated block for
tryandasyncin macros. - Make
unconditional_recursionlint detect recursive drops. - Future compatibility warning for some impls being incorrectly considered not overlapping.
- The
invalid_reference_castinglint is now deny-by-default (instead of allow-by-default)
Compiler
- Write version information in a
.commentsection 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-threadsas a tier 2 target.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Add
Read,WriteandSeekimpls forArc<File>. - Merge functionality of
io::Sinkintoio::Empty. - Implement
RefUnwindSafeforBacktrace - Make
ExitStatusimplementDefault 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
statstruct definitions.
Stabilized APIs
- Unsigned
{integer}::div_ceil - Unsigned
{integer}::next_multiple_of - Unsigned
{integer}::checked_next_multiple_of std::ffi::FromBytesUntilNulErrorstd::os::unix::fs::chownstd::os::unix::fs::fchownstd::os::unix::fs::lchownLocalKey::<Cell<T>>::getLocalKey::<Cell<T>>::setLocalKey::<Cell<T>>::takeLocalKey::<Cell<T>>::replaceLocalKey::<RefCell<T>>::with_borrowLocalKey::<RefCell<T>>::with_borrow_mutLocalKey::<RefCell<T>>::setLocalKey::<RefCell<T>>::takeLocalKey::<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_apfloatwith the new version of the crate. - Update to LLVM 17.
- Add
internal_featureslint 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_dropslint - Uplift
clippy::invalid_utf8_in_uncheckedlint asinvalid_from_utf8_uncheckedandinvalid_from_utf8 - Uplift
clippy::cast_ref_to_mutlint asinvalid_reference_casting - Uplift
clippy::cmp_nanlint asinvalid_nan_comparisons - resolve: Remove artificial import ambiguity errors
- Don't require associated types with Self: Sized bounds in
dyn Traitobjects
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_framefrom 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: Sizedbounds onBufReader<T>,BufWriter<T>andLineWriter<T> - Update runtime guarantee for
select_nth_unstable - Return
Okon kill if process has already exited - Implement PartialOrd for
Vecs 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_eqignore 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-workspaceby 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.jobsparallelism back to the default. #12222
Compatibility Notes
- Alter
DisplayforIpv6Addrfor 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_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
Rust 1.71.0
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
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 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
Dropimplementation, but panicking within a panic hook is now an immediate abort. - Loosen
From<&[T]> for Box<[T]>bound toT: Clone. - 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.
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...)(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_unalignedptr::readptr::read_unaligned<[T]>::split_at
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.
Rustdoc
- Add a new
rustdoc::unescaped_backtickslint for broken inline code. - Support strikethrough with single tildes. (
~~old~~vs.~new~)
Misc
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.
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_argsinvocations to uses captures - Lint ambiguous glob re-exports
- Perform const and unsafe checking for expressions in
let _ = exprposition.
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_allocationlint againstBox::newtoo - 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
Commandprefer 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_cmpto 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
FnPtrtrait that is implemented for all function pointers This extendsDebug,Pointer,Hash,PartialEq,Eq,PartialOrd, andOrdimplementations for function pointers with all ABIs.
Stabilized APIs
NonZero*::MIN/MAXBinaryHeap::retainDefault for std::collections::binary_heap::IntoIterDefault 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::RangeDefault for std::collections::btree_set::{IntoIter, Iter}Default for std::collections::btree_set::RangeDefault for std::collections::linked_list::{IntoIter, Iter, IterMut}Default for std::vec::IntoIterDefault for std::iter::ChainDefault for std::iter::ClonedDefault for std::iter::CopiedDefault for std::iter::EnumerateDefault for std::iter::FlattenDefault for std::iter::FuseDefault for std::iter::RevDefault for std::slice::IterDefault for std::slice::IterMutRc::into_innerArc::into_innerstd::cell::OnceCellOption::is_some_andNonNull::slice_from_raw_partsResult::is_ok_andResult::is_err_andstd::sync::atomic::Atomic*::as_ptrstd::io::IsTerminalstd::os::linux::net::SocketAddrExtstd::os::unix::net::UnixDatagram::bind_addrstd::os::unix::net::UnixDatagram::connect_addrstd::os::unix::net::UnixDatagram::send_to_addrstd::os::unix::net::UnixListener::bind_addrstd::path::Path::as_mut_os_strstd::sync::OnceLock
Cargo
- Add
CARGO_PKG_README - Make
sparsethe 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
libtestfrom supporting-Zunstable-options - Perform const and unsafe checking for expressions in
let _ = exprposition. - WebAssembly targets enable
sign-extandmutable-globalsfeatures 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.