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.