Rust 1.65.0
Language
- Error on
as
casts of enums with#[non_exhaustive]
variants - Stabilize
let else
- Stabilize generic associated types (GATs)
- Add lints
let_underscore_drop
andlet_underscore_lock
from Clippy - Stabilize
break
ing from arbitrary labeled blocks ("label-break-value") - Uninitialized integers, floats, and raw pointers are now considered immediate UB. Usage of
MaybeUninit
is the correct way to work with uninitialized memory. - Stabilize raw-dylib for Windows x86_64, aarch64, and thumbv7a
- Do not allow
Drop
impl on foreign ADTs
Compiler
- Stabilize -Csplit-debuginfo on Linux
- Use niche-filling optimization even when multiple variants have data
- Associated type projections are now verified to be well-formed prior to resolving the underlying type
- Stringify non-shorthand visibility correctly
- Normalize struct field types when unsizing
- Update to LLVM 15
- Fix aarch64 call abi to correctly zeroext when needed
- debuginfo: Generalize C++-like encoding for enums
- Add
special_module_name
lint - Add support for generating unique profraw files by default when using
-C instrument-coverage
- Allow dynamic linking for iOS/tvOS targets
New targets:
- Add armv4t-none-eabi as a tier 3 target
- Add powerpc64-unknown-openbsd and riscv64-unknown-openbsd as tier 3 targets
- Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Don't generate
PartialEq::ne
in derive(PartialEq) - Windows RNG: Use
BCRYPT_RNG_ALG_HANDLE
by default - Forbid mixing
System
with direct system allocator calls - Document no support for writing to non-blocking stdio/stderr
std::layout::Layout
size must not overflowisize::MAX
when rounded up toalign
This also changes the safety conditions onLayout::from_size_align_unchecked
.
Stabilized APIs
std::backtrace::Backtrace
Bound::as_ref
std::io::read_to_string
<*const T>::cast_mut
<*mut T>::cast_const
These APIs are now stable in const contexts:
Cargo
- Apply GitHub fast path even for partial hashes
- Do not add home bin path to PATH if it's already there
- Take priority into account within the pending queue. This slightly optimizes job scheduling by Cargo, with typically small improvements on larger crate graph builds.
Compatibility Notes
std::layout::Layout
size must not overflowisize::MAX
when rounded up toalign
. This also changes the safety conditions onLayout::from_size_align_unchecked
.PollFn
now only implementsUnpin
if the closure isUnpin
. This is a possible breaking change if users were relying on the blanket unpin implementation. See discussion on the PR for details of why this change was made.- Drop ExactSizeIterator impl from std::char::EscapeAscii This is a backwards-incompatible change to the standard library's surface area, but is unlikely to affect real world usage.
- Do not consider a single repeated lifetime eligible for elision in the return type This behavior was unintentionally changed in 1.64.0, and this release reverts that change by making this an error again.
- Reenable disabled early syntax gates as future-incompatibility lints
- Update the minimum external LLVM to 13
- Don't duplicate file descriptors into stdio fds
- Sunset RLS
- Deny usage of
#![cfg_attr(..., crate_type = ...)]
to set the crate type This strengthens the forward compatibility lint deprecated_cfg_attr_crate_type_name to deny. llvm-has-rust-patches
allows setting the build system to treat the LLVM as having Rust-specific patches This option may need to be set for distributions that are building Rust with a patched LLVM viallvm-config
, not the built-in LLVM.- Combining three or more languages (e.g. Objective C, C++ and Rust) into one binary may hit linker limitations when using
lld
. For more information, see issue 102754.
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.
- Add
x.sh
andx.ps1
shell scripts - compiletest: use target cfg instead of hard-coded tables
- Use object instead of LLVM for reading bitcode from rlibs
- Enable MIR inlining for optimized compilations This provides a 3-10% improvement in compiletimes for real world crates. See perf results.