Releases: rust-lang/rust
Rust 1.79.0
Language
- Stabilize inline
const {}expressions. - Prevent opaque types being instantiated twice with different regions within the same function.
- Stabilize WebAssembly target features that are in phase 4 and 5.
- Add the
redundant_lifetimeslint to detect lifetimes which are semantically redundant. - Stabilize the
unnameable_typeslint for public types that can't be named. - Enable debuginfo in macros, and stabilize
-C collapse-macro-debuginfoand#[collapse_debuginfo]. - Propagate temporary lifetime extension into
ifandmatchexpressions. - Restrict promotion of
const fncalls. - Warn against refining impls of crate-private traits with
refining_impl_traitlint. - Stabilize associated type bounds (RFC 2289).
- Stabilize importing
mainfrom other modules or crates. - Check return types of function types for well-formedness
- Rework
impl Traitlifetime inference - Change inductive trait solver cycles to be ambiguous
Compiler
- Define
-C stripto only affect binaries, not artifacts like.pdb. - Stabilize
-Crelro-levelfor controlling runtime link hardening. - Stabilize checking of
cfgnames and values at compile-time with--check-cfg. Note that this only stabilizes the compiler part, the Cargo part is still unstable in this release. - Add
aarch64-apple-visionosandaarch64-apple-visionos-simtier 3 targets. - Add
riscv32ima-unknown-none-elftier 3 target. - Promote several Windows targets to tier 2:
aarch64-pc-windows-gnullvm,i686-pc-windows-gnullvm, andx86_64-pc-windows-gnullvm.
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Implement
FromIteratorfor(impl Default + Extend, impl Default + Extend). - Implement
{Div,Rem}Assign<NonZero<X>>onX. - Document overrides of
clone_from()in core/std. - Link MSVC default lib in core.
- Caution against using
transmutebetween pointers and integers. - Enable frame pointers for the standard library.
Stabilized APIs
{integer}::unchecked_add{integer}::unchecked_mul{integer}::unchecked_sub<[T]>::split_at_unchecked<[T]>::split_at_mut_unchecked<[u8]>::utf8_chunksstr::Utf8Chunksstr::Utf8Chunk<*const T>::is_aligned<*mut T>::is_alignedNonNull::is_aligned<*const [T]>::len<*mut [T]>::len<*const [T]>::is_empty<*mut [T]>::is_emptyNonNull::<[T]>::is_emptyCStr::count_bytesio::Error::downcastnum::NonZero<T>path::absoluteproc_macro::Literal::byte_characterproc_macro::Literal::c_string
These APIs are now stable in const contexts:
Atomic*::into_innerio::Cursor::newio::Cursor::get_refio::Cursor::positionio::emptyio::repeatio::sinkpanic::Location::callerpanic::Location::filepanic::Location::linepanic::Location::column
Cargo
- Prevent dashes in
lib.name, always normalizing to_. - Stabilize MSRV-aware version requirement selection in
cargo add. - Switch to using
gitoxideby default for listing files.
Rustdoc
- Always display stability version even if it's the same as the containing item.
- Show a single search result for items with multiple paths.
- Support typing
/in docs to begin a search.
Misc
Compatibility Notes
- Update the minimum external LLVM to 17.
RustcEncodableandRustcDecodableare soft-destabilized, to be removed from the prelude in next edition.- The
wasm_c_abifuture-incompatibility lint will warn about use of the non-spec-compliant C ABI. Usewasm-bindgen v0.2.88to generate forward-compatible bindings. - Check return types of function types for well-formedness
Rust 1.78.0
Language
- Stabilize
#[cfg(target_abi = ...)] - Stabilize the
#[diagnostic]namespace and#[diagnostic::on_unimplemented]attribute - Make async-fn-in-trait implementable with concrete signatures
- Make matching on NaN a hard error, and remove the rest of
illegal_floating_point_literal_pattern - static mut: allow mutable reference to arbitrary types, not just slices and arrays
- Extend
invalid_reference_castingto include references casting to bigger memory layout - Add
non_contiguous_range_endpointslint for singleton gaps after exclusive ranges - Add
wasm_c_abilint for use of older wasm-bindgen versions This lint currently only works when using Cargo. - Update
indirect_structural_matchandpointer_structural_matchlints to match RFC - Make non-
PartialEq-typed consts as patterns a hard error - Split
refining_impl_traitlint into_reachable,_internalvariants - Remove unnecessary type inference when using associated types inside of higher ranked
where-bounds - Weaken eager detection of cyclic types during type inference
trait Trait: Auto {}: allow upcasting fromdyn Traittodyn Trait + Auto
Compiler
- Made
INVALID_DOC_ATTRIBUTESlint deny by default - Increase accuracy of redundant
usechecking - Suggest moving definition if non-found macro_rules! is defined later
- Lower transmutes from int to pointer type as gep on null
Target changes:
- Windows tier 1 targets now require at least Windows 10
- Add
wasm32-wasip1tier 2 (without host tools) target - Add
wasm32-wasip2tier 3 target - Rename
wasm32-wasi-preview1-threadstowasm32-wasip1-threads - Add
arm64ec-pc-windows-msvctier 3 target - Add
armv8r-none-eabihftier 3 target for the Cortex-R52 - Add
loongarch64-unknown-linux-musltier 3 target
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Bump Unicode to version 15.1.0, regenerate tables
- Make align_offset, align_to well-behaved in all cases
- PartialEq, PartialOrd: document expectations for transitive chains
- Optimize away poison guards when std is built with panic=abort
- Replace pthread
RwLockwith custom implementation - Implement unwind safety for Condvar on all platforms
- Add ASCII fast-path for
char::is_grapheme_extended
Stabilized APIs
impl Read for &Stdin- Accept non
'staticlifetimes for severalstd::error::Errorrelated implementations - Make
impl<Fd: AsFd>impl take?Sized impl From<TryReserveError> for io::Error
These APIs are now stable in const contexts:
Cargo
- Stabilize lockfile v4
- Respect
rust-versionwhen generating lockfile - Control
--charsetvia auto-detecting config value - Support
target.<triple>.rustdocflagsofficially - Stabilize global cache data tracking
Compatibility Notes
- Many unsafe precondition checks now run for user code with debug assertions enabled This change helps users catch undefined behavior in their code, though the details of how much is checked are generally not stable.
- riscv only supports split_debuginfo=off for now
- Consistently check bounds on hidden types of
impl Trait - Change equality of higher ranked types to not rely on subtyping
- When called, additionally check bounds on normalized function return type
- Expand coverage for
arithmetic_overflowlint - Fix detection of potential interior mutability in
constinitializers This code was accidentally accepted. The fix can break generic code that borrows a value of unknown type, as there is currently no way to declare "this type has no interior mutability". In the future, stabilizing theFreezetrait will allow proper support for such code.
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.77.2
Rust 1.77.1
- Revert stripping debuginfo by default for Windows This fixes a regression in 1.77 by reverting to the previous default. Platforms other than Windows are not affected.
- Internal: Fix heading anchor rendering in doc pages
Rust 1.77.0
Language
- Reveal opaque types within the defining body for exhaustiveness checking.
- Stabilize C-string literals.
- Stabilize THIR unsafeck.
- Add lint
static_mut_refsto warn on references to mutable statics. - Support async recursive calls (as long as they have indirection).
- Undeprecate lint
unstable_featuresand make use of it in the compiler. - Make inductive cycles in coherence ambiguous always.
- Get rid of type-driven traversal in const-eval interning, only as a future compatibility lint for now.
- Deny braced macro invocations in let-else.
Compiler
- Include lint
soft_unstablein future breakage reports. - Make
i128andu12816-byte aligned on x86-based targets. - Use
--verbosein diagnostic output. - Improve spacing between printed tokens.
- Merge the
unused_tuple_struct_fieldslint intodead_code. - Error on incorrect implied bounds in well-formedness check, with a temporary exception for Bevy.
- Fix coverage instrumentation/reports for non-ASCII source code.
- Fix
fn/constitems implied bounds and well-formedness check. - Promote
riscv32{im|imafc}-unknown-none-elftargets to tier 2. - Add several new tier 3 targets:
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
Stabilized APIs
array::each_refarray::each_mutcore::netf32::round_ties_evenf64::round_ties_evenmem::offset_of!slice::first_chunkslice::first_chunk_mutslice::split_first_chunkslice::split_first_chunk_mutslice::last_chunkslice::last_chunk_mutslice::split_last_chunkslice::split_last_chunk_mutslice::chunk_byslice::chunk_by_mutBound::mapFile::create_newMutex::clear_poisonRwLock::clear_poison
Cargo
- Extend the build directive syntax with
cargo::. - Stabilize metadata
idformat asPackageIDSpec. - Pull out
cargo-util-schemasas a crate. - Strip all debuginfo when debuginfo is not requested.
- Inherit jobserver from env for all kinds of runners.
- Deprecate rustc plugin support in cargo.
Rustdoc
- Allows links in markdown headings.
- Search for tuples and unit by type with
(). - Clean up the source sidebar's hide button.
- Prevent JS injection from
localStorage.
Misc
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.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.