Releases: rust-lang/rust
Release list
Rust 1.98.1
Rust 1.98.0
Language
- Allow shortening lifetime of
&mutwhen unsize-coercing, even in an invariant position. For example, you can now coerce aCell<&'long mut i32>to aCell<&'short mut dyn Send>. Such shortenings were already previously allowed when coercing a&mutto a&, or coercing a&to a&. - Add deny-by-default
invalid_runtime_symbol_definitionslint and warn-by-defaultsuspicious_runtime_symbol_definitionslint- The lints currently specifically targets
coreruntime symbols likememcmp,memset,strlen, ... and is planned to be expanded in the next few releases.
- The lints currently specifically targets
- Add warn-by-default
c_void_returnslint to checkcore::ffi::c_voidas a return type
Platform Support
- Add
powerpc64-unknown-linux-gnuelfv2as Tier 3 - Add
aarch64-unknown-linux-pauthtestas Tier 3 target - Promote
thumbv7a-none-eabito Tier 2 - Promote
thumbv7a-none-eabihfto Tier 2 - Promote
thumbv7r-none-eabito Tier 2 - Promote
thumbv7r-none-eabihfto Tier 2 - Promote
thumbv8r-none-eabihfto Tier 2
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Change
Location<'_>lifetime to'staticinPanic[Hook]Info - Document panic in
RangeInclusive::from(legacy::RangeInclusive) - Document that
ManuallyDrop'sBoxinteraction has been fixed - Stabilize LoongArch CRC Intrinsics
- The
derivemacro is available at{core,std}::derive. This was previously unintentionally stabilized in 1.96, but is now explicitly accepted as a stabilized API.- Please note that the MSRV for
{core,std}::derivewill be 1.96, and not 1.98.
- Please note that the MSRV for
Stabilized APIs
str::substr_range[T]::subslice_rangecore::fmt::NumBuffer<{integer}>::format_intoSend/Sync for std::process::CommandArgs{fN}::algebraic_add{fN}::algebraic_sub{fN}::algebraic_mul{fN}::algebraic_div{fN}::algebraic_remNonZero<{integer}>::from_str_radixString::from_utf16leString::from_utf16le_lossyString::from_utf16beString::from_utf16be_lossy[T]::strip_circumfixstr::strip_circumfixAtomic<T>::from_mutAtomic<T>::get_mut_sliceAtomic<T>::from_mut_slicestd::range::legacybool::ok_orbool::ok_or_else
Compatibility Notes
- If fully elided, lifetime bounds of trait object types may now resolve differently or even get rejected in very specific niche scenarios
- Error in more cases of ambiguous imports
- Switch the destructors implementation for thread locals on Windows to use Fiber Local Storage (FLS)
- Convert some cases of the
ambiguous_glob_importslint into a hard error - Where-bounds of the form
Type = TypeandType == Typeare no longer syntactically allowed - Ensure Send/Sync is not implemented for std::env::Vars{,Os}
- Fix that in some attributes, arguments were not properly rejected
repr(transparent)is now more strict about which fields have "trivial" layout and hence can be ignored:repr(C)types, types with private fields, and#[non_exhaustive]types are no longer considered "trivial"- Correctly check whether types have equal size in
transmute()when somereprattributes are involved. - More characters are escaped when printing strings and chars
- Implement fast path for
derive(PartialOrd)when derivingOrdThis can break crates in practice where a type's PartialOrd and Ord impls were inconsistent with each other. - Add temporary scope to
assert_eqandassert_ne - Closed a hole in the pattern matching structural equality check, preventing cases where a match of a constant would be allowed, despite disagreeing with a manually written
PartialEqimplementation, when aderive(PartialEq)implementation for that type also exists. - On Emscripten the WASM exception handling ABI is now unconditionally used The
-Zemscripten-wasm-eh=falseflag to switch back to JS exceptions has been removed. - The UNSAFE_CODE lint is now consistently emitted for all unsafe attributes
- Solaris: remove
File::lockimplementation, it has the wrong semantics (return "unsupported" instead) - Windows-gnu targets now specify baseline tools versions
- rustfmt now discovers module files that are defined in
cfg_select!This may cause more code to be formatted which was previously ignored.
Rust 1.97.1
- rustc: Fix miscompilation in LLVM optimization This backports an LLVM submodule bump to include the LLVM-side fix and a revert of the rustc change that is one known trigger for the bug. The rustc side revert should not be strictly necessary but is done out of abundance of caution.
Rust 1.97.0
Language
- Consider
Result<T, Uninhabited>andControlFlow<Uninhabited, T>to be equivalent toTfor must use lint - Add allow-by-default
dead_code_pub_in_binarylint for unused pub items in binary crates - Stabilize the
div32,lam-bh,lamcas,ld-seq-saandscqtarget features - Stabilize
cfg(target_has_atomic_primitive_alignment) - Allow trailing
selfin imports in more cases
Platform Support
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Stabilized APIs
Default for RepeatNCopy for ffi::FromBytesUntilNulErrorSend for std::fs::Fileon UEFI<{integer}>::isolate_highest_one<{integer}>::isolate_lowest_one<{integer}>::highest_one<{integer}>::lowest_one<{integer}>::bit_widthNonZero<{integer}>::isolate_highest_oneNonZero<{integer}>::isolate_lowest_oneNonZero<{integer}>::highest_oneNonZero<{integer}>::lowest_oneNonZero<{integer}>::bit_width
These previously stable APIs are now stable in const contexts:
Cargo
- Stabilize
build.warningsconfig. This controls how lint warnings from local packages are treated. Useful for enforcing a warning-free build in CI, replacing-Dwarnings. docs - Stabilize
resolver.lockfile-pathconfig. This allows specifying the path to the lockfile to use when resolving dependencies. Useful when working with read-only source directories. docs - cargo-clean: Error when
--target-dirdoesn't look like a Cargo target directory. This prevents accidental deletion of non-target directories. - Add
-mshorthand for--manifest-path - Remove
curldependency fromcrates-iocrate
Rustdoc
Compatibility Notes
- Emit a future-compatibility warning when relying on
f32: From<{float}>to constrain{float} - Rust will use the v0 symbol mangling scheme by default. This may cause some tools (such as debuggers or profilers, especially with old versions) to fail to demangle symbols emitted by Rust. It may also cause the formatting of text in backtraces to change.
- Prevent deref coercions in
pin!, in order to prevent unsoundness. The most likely case where this might impact users is: writingpin!(x)wherexhas type&mut Twill now always correctly produce a value of typePin<&mut &mut T>, instead of sometimes allowing a coercion that produces a value of typePin<&mut T>. This coercion was previously incorrectly allowed since Rust 1.88.0. - Deprecate
std::charconstants and functions - Warn on linker output by default
- Remove hidden
f64methods which have been deprecated since 1.0 - report the
varargs_without_patternlint in deps - Forbid passing generic arguments to module path segments even if the module reexports a generic enum variant
- Error on invalid macho
link_sectionspecifier - The encoding of certain
enums have changed. This is not a breaking change, as it only applies toenums without layout guarantees, but is noted here as we've seen people impacted from having made assumptions about the layout algorithm. - Error on
#[export_name = "..."]where the name is empty - Syntactically reject tuple index shorthands in struct patterns
- validate
#[link_name = "..."]&#[link(name = "...")]parameters - On Windows, after calling
shutdownon a socket to shut down the write side, attempting to write to the socket will now produce aBrokenPipeerror rather thanOther. MapWSAESHUTDOWNtoio::ErrorKind::BrokenPipe
Rust 1.96.1
Rust 1.96.0
Language
- Allow passing
exprmetavariable tocfg - Always coerce never types in tuple expressions
- Avoid incorrect inference guidance of function arguments in rare cases
- Support s390x vector registers in inline assembly
- Allow using constants of type
ManuallyDropas patterns (fixing a regression introduced in 1.94.0)
Compiler
- Enable link relaxation feature for LoongArch Linux targets
- Update
riscv64gc-unknown-fuchsiabaseline to RVA22 + vector
Libraries
- Support iterating over ranges of
NonZerointegers - refactor 'valid for read/write' definition: exclude null; add that as an exception on individual methods instead
- Fix SGX delayed host lookup via ToSocketAddr
Stabilized APIs
assert_matches!debug_assert_matches!From<T> for AssertUnwindSafe<T>From<T> for LazyCell<T, F>From<T> for LazyLock<T, F>core::range::RangeToInclusivecore::range::RangeToInclusiveItercore::range::RangeFromcore::range::RangeFromItercore::range::Rangecore::range::RangeIter
Cargo
- Allow a dependency to specify both a git repository and an alternate registry. Just like with crates.io, the git repository will be used locally, but the registry version will be used when published.
- Added
target.'cfg(..)'.rustdocflagssupport in configuration. - Fixed CVE-2026-5222 and CVE-2026-5223.
Rustdoc
- Deprecation notes are now rendered like any other documentation. Previously they used the css
white-space: pre-wrap;property and stripped any<p>elements from the rendered html, however this caused issues and unintuitive behavior. The new behavior should be more predictable, however some multi-line deprecation notes will now be rendered as as single lines. If this is undesirable, you can use the standard markdown method of forcing a linebreak, which is two spaces followed by a newline ("\n"). - Don't emit rustdoc
missing_doc_code_exampleslint on impl items - Separate methods and associated functions in sidebar
Compatibility Notes
- Fix layout of
#[repr(Int)]enums in some edge cases involving fields of uninhabited zero-sized types - Prevent unsize-coercing into
Pin<Foo>whereFoodoesn't implementDeref. Some such coercions were previously allowed, but produce a type with no useful public API. - rustc: Stop passing
--allow-undefinedon wasm targets - Gate the accidentally stabilized
#![reexport_test_harness_main]attribute - Error on return-position-impl-trait-in-traits whose types are too private
- Report the
uninhabited_staticlint in dependencies and make it deny-by-default - Distributed builds now contain non-split debuginfo for windows-gnu This appears to improve the quality of backtraces. This change has no effect on the defaults for the output of rustc/cargo on these targets.
- Check const generic arguments are correctly typed in more positions
- Remove
-Csoft-float - Importing structs with
::{self [as name]}, e.g.,struct S {}; use S::{self as Other};, is now no longer permitted because{self}imports require a module parent. - For
export_name,link_name, andlink_sectionattributes, if multiple of the same attribute is present, the first one now takes precedence. - Update the minimum external LLVM to 21
- On
avrtargets, C'sdoubletype is 32-bit by default, so changec_doubletof32onavrtargets to match. This is a breaking change, but necessary to makec_doublematch C's double. BTreeMap::append()was optimized, which may now cause panics for types with incorrectOrdimpls
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.95.0
Language
- Stabilize
if letguards on match arms irrefutable_let_patternslint no longer lints on let chains- Support importing path-segment keywords with renaming
- Stabilize inline assembly for PowerPC and PowerPC64
- const-eval: be more consistent in the behavior of padding during typed copies
- Const blocks are no longer evaluated to determine if expressions involving fallible operations can implicitly be constant-promoted.. Expressions whose ability to implicitly be promoted would depend on the result of a const block are no longer implicitly promoted.
- Make operational semantics of pattern matching independent of crate and module
Compiler
- Stabilize
--remap-path-scopefor controlling the scoping of how paths get remapped in the resulting binary - Apply patches for CVE-2026-6042 and CVE-2026-40200 to vendored musl
Platform Support
- Promote
powerpc64-unknown-linux-muslto Tier 2 with host tools - Promote
aarch64-apple-tvosto Tier 2 - Promote
aarch64-apple-tvos-simto Tier 2 - Promote
aarch64-apple-watchosto Tier 2 - Promote
aarch64-apple-watchos-simto Tier 2 - Promote
aarch64-apple-visionosto Tier 2 - Promote
aarch64-apple-visionos-simto Tier 2
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
thread::scope: document how join interacts with TLS destructors- Speed up
str::containson aarch64 targets withneontarget feature enabled by default
Stabilized APIs
MaybeUninit<[T; N]>: From<[MaybeUninit<T>; N]>MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>; N]>MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>]>MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>; N]>MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>]>[MaybeUninit<T>; N]: From<MaybeUninit<[T; N]>>Cell<[T; N]>: AsRef<[Cell<T>; N]>Cell<[T; N]>: AsRef<[Cell<T>]>Cell<[T]>: AsRef<[Cell<T>]>bool: TryFrom<{integer}>AtomicPtr::updateAtomicPtr::try_updateAtomicBool::updateAtomicBool::try_updateAtomicIn::updateAtomicIn::try_updateAtomicUn::updateAtomicUn::try_updatecfg_select!mod core::rangecore::range::RangeInclusivecore::range::RangeInclusiveItercore::hint::cold_path<*const T>::as_ref_unchecked<*mut T>::as_ref_unchecked<*mut T>::as_mut_uncheckedVec::push_mutVec::insert_mutVecDeque::push_front_mutVecDeque::push_back_mutVecDeque::insert_mutLinkedList::push_front_mutLinkedList::push_back_mutLayout::dangling_ptrLayout::repeatLayout::repeat_packedLayout::extend_packed
These previously stable APIs are now stable in const contexts:
Rustdoc
Compatibility Notes
- Array coercions may now result in less inference constraints than before
- Importing
$cratewithout renaming, i.e.use $crate::{self};, is now no longer permitted due to stricter error checking forselfimports. - const-eval: be more consistent in the behavior of padding during typed copies. In very rare cases, this may cause compilation errors due to bytes from parts of a pointer ending up in the padding bytes of a
constorstatic. - A future-incompatibility warning lint
ambiguous_glob_imported_traitsis now reported when using an ambiguously glob imported trait - Check lifetime bounds of types mentioning only type parameters
- Report more visibility-related ambiguous import errors
- Deprecate
Eq::assert_receiver_is_total_eqand emit future compatibility warnings on manual impls - powerpc64: Use the ELF ABI version set in target spec instead of guessing (fixes the ELF ABI used by the OpenBSD target)
- Matching on a
#[non_exhaustive]enum now reads the discriminant, even if the enum has only one variant. This can cause closures to capture values that they previously wouldn't. mut refandmut ref mutpatterns, part of the unstable Match Ergonomics 2024 RFC, were accidentally allowed on stable within struct pattern field shorthand. These patterns are now correctly feature-gated as unstable in this position.- Add future-compatibility warning for derive helper attributes which conflict with built-in attributes
- [JSON target specs](https://doc.rust-lang.org/rustc/targe...
Rust 1.94.1
- Fix
std::thread::spawnon wasm32-wasip1-threads - Remove new methods added to
std::os::windows::fs::OpenOptionsExtThe new methods were unstable, but the trait itself is not sealed and so cannot be extended with non-default methods. - Clippy: fix ICE in
match_same_arms - Cargo: update tar to 0.4.45 This resolves CVE-2026-33055 and CVE-2026-33056. Users of crates.io are not affected. See blog for more details.
Rust 1.94.0
Language
- Impls and impl items inherit
dead_codelint level of the corresponding traits and trait items - Stabilize additional 29 RISC-V target features including large portions of the RVA22U64 / RVA23U64 profiles
- Add warn-by-default
unused_visibilitieslint for visibility onconst _declarations - Update to Unicode 17
- Avoid incorrect lifetime errors for closures
Platform Support
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
Stabilized APIs
<[T]>::array_windows<[T]>::element_offsetLazyCell::getLazyCell::get_mutLazyCell::force_mutLazyLock::getLazyLock::get_mutLazyLock::force_mutimpl TryFrom<char> for usizestd::iter::Peekable::next_if_mapstd::iter::Peekable::next_if_map_mut- x86
avx512fp16intrinsics (excluding those that depend directly on the unstablef16type) - AArch64 NEON fp16 intrinsics (excluding those that depend directly on the unstable
f16type) f32::consts::EULER_GAMMAf64::consts::EULER_GAMMAf32::consts::GOLDEN_RATIOf64::consts::GOLDEN_RATIO
These previously stable APIs are now stable in const contexts:
Cargo
- Stabilize the config include key. The top-level include config key allows loading additional config files, enabling better organization, sharing, and management of Cargo configurations across projects and environments. docs #16284
- Stabilize the pubtime field in registry index. This records when a crate version was published and enables time-based dependency resolution in the future. Note that crates.io will gradually backfill existing packages when a new version is published. Not all crates have pubtime yet. #16369 #16372
- Cargo now parses TOML v1.1 for manifests and configuration files. Note that using these features in Cargo.toml will raise your development MSRV, but the published manifest remains compatible with older parsers. #16415
- Make
CARGO_BIN_EXE_<crate>available at runtime
Compatibility Notes
- Forbid freely casting lifetime bounds of
dyn-types - Make closure capturing have consistent and correct behaviour around patterns Some finer details of how precise closure captures get affected by pattern matching have been changed. In some cases, this can cause a non-move closure that was previously capturing an entire variable by move, to now capture only part of that variable by move, and other parts by borrow. This can cause the borrow checker to complain where it previously didn't, or cause
Dropto run at a different point in time. - Standard library macros are now imported via prelude, not via injected
#[macro_use]This will raise an error if macros of the same name are glob imported. For example if a crate defines their ownmatchesmacro and then glob imports that, it's now ambiguous whether the custom or standard librarymatchesis meant and an explicit import of the name is required to resolve the ambiguity. One exception iscore::panicandstd::panic, if their import is ambiguous a new warning (ambiguous_panic_imports) is raised. This may raise a new warning (ambiguous_panic_imports) on#![no_std]code glob importing the std crate. Bothcore::panic!andstd::panic!are then in scope and which is used is ambiguous. - Don't strip shebang in expression-context
include!(…)s This can cause previously working includes to no longer compile if they included files which started with a shebang. - Ambiguous glob reexports are now also visible cross-crate This unifies behavior between local and cross-crate errors on these exports, which may introduce new ambiguity errors.
- Don't normalize where-clauses before checking well-formedness
- Introduce a future compatibility warning on codegen attributes on body-free trait methods These attributes currently have no effect in this position.
- On Windows
std::time::SystemTime::checked_sub_durationwill returnNonefor times before the Windows epoch (1/1/1601) - Lifetime identifiers such as
'aare now NFC normalized. - Overhaul filename handling for cross-compiler consistency Any paths emitted by compiler now always respect the relative-ness of the paths and
--remap-path-prefixgiven originally. One side-effect of this change is that paths emitted for local crates in Cargo (path dependencies and workspace members) are no longer absolute but relative when emitted as part of a diagnostic in a downstream crate.
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.
- Switch to
annotate-snippetsfor error emission This should preserve mostly the same outputs in rustc error messages.
Rust 1.93.1
- Don't try to recover keyword as non-keyword identifier, fixing an ICE that especially affected rustfmt.
- Fix
clippy::panicking_unwrapfalse-positive on field access with implicit deref. - Revert "Update wasm-related dependencies in CI", fixing file descriptor leaks on the
wasm32-wasip2target.