Version 1.64.0 (2022-09-22)
Language
- Unions with mutable references or tuples of allowed types are now allowed
- It is now considered valid to deallocate memory pointed to by a shared reference
&Tif every byte inTis inside anUnsafeCell - Unused tuple struct fields are now warned against in an allow-by-default lint,
unused_tuple_struct_fields, similar to the existing warning for unused struct fields. This lint will become warn-by-default in the future.
Compiler
- Add Nintendo Switch as tier 3 target
- Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
- Only compile
#[used]as llvm.compiler.used for ELF targets - Add the
--diagnostic-widthcompiler flag to define the terminal width. - Add support for link-flavor
rust-lldfor iOS, tvOS and watchOS
Libraries
- Remove restrictions on compare-exchange memory ordering.
- You can now
write!orwriteln!into anOsString: Implementfmt::WriteforOsString - Make RwLockReadGuard covariant
- Implement
FusedIteratorforstd::net::[Into]Incoming impl<T: AsRawFd> AsRawFd for {Arc,Box}<T>ptr::copyandptr::swapare doing untyped copies- Add cgroupv1 support to
available_parallelism - Mitigate many incorrect uses of
mem::uninitialized
Stabilized APIs
future::IntoFuturefuture::poll_fntask::ready!num::NonZero*::checked_mulnum::NonZero*::checked_pownum::NonZero*::saturating_mulnum::NonZero*::saturating_pownum::NonZeroI*::absnum::NonZeroI*::checked_absnum::NonZeroI*::overflowing_absnum::NonZeroI*::saturating_absnum::NonZeroI*::unsigned_absnum::NonZeroI*::wrapping_absnum::NonZeroU*::checked_addnum::NonZeroU*::checked_next_power_of_twonum::NonZeroU*::saturating_addos::unix::process::CommandExt::process_groupos::windows::fs::FileTypeExt::is_symlink_diros::windows::fs::FileTypeExt::is_symlink_file
These types were previously stable in std::ffi, but are now also available in core and alloc:
core::ffi::CStrcore::ffi::FromBytesWithNulErroralloc::ffi::CStringalloc::ffi::FromVecWithNulErroralloc::ffi::IntoStringErroralloc::ffi::NulError
These types were previously stable in std::os::raw, but are now also available in core::ffi and std::ffi:
ffi::c_charffi::c_doubleffi::c_floatffi::c_intffi::c_longffi::c_longlongffi::c_scharffi::c_shortffi::c_ucharffi::c_uintffi::c_ulongffi::c_ulonglongffi::c_ushort
These APIs are now usable in const contexts:
Cargo
- Packages can now inherit settings from the workspace so that the settings
can be centralized in one place. See
workspace.packageandworkspace.dependenciesfor more details on how to define these common settings. - Cargo commands can now accept multiple
--targetflags to build for multiple targets at once, and thebuild.targetconfig option may now take an array of multiple targets. - The
--jobsargument can now take a negative number to count backwards from the max CPUs. cargo addwill now updateCargo.lock.- Added the
--crate-typeflag tocargo rustcto override the crate type. - Significantly improved the performance fetching git dependencies from GitHub
when using a hash in the
revfield.
Misc
Compatibility Notes
- The minimum required versions for all
-linux-gnutargets are now at least kernel 3.2 and glibc 2.17, for targets that previously supported older versions: Increase the minimum linux-gnu versions - Network primitives are now implemented with the ideal Rust layout, not the C system layout. This can cause problems when transmuting the types.
- Add assertion that
transmute_copy'sUis not larger thanT - A soundness bug in
BTreeMapwas fixed that allowed data it was borrowing to be dropped before the container. - The Drop behavior of C-like enums cast to ints has changed. These are already discouraged by a compiler warning.
- Relate late-bound closure lifetimes to parent fn in NLL
- Errors at const-eval time are now in future incompatibility reports
- On the
thumbv6m-none-eabitarget, some incorrectasm!statements were erroneously accepted if they used the high registers (r8 to r14) as an input/output operand. This is no longer accepted. impl Traitwas accidentally accepted as the associated type value of return-positionimpl Trait, without fulfilling all the trait bounds of that associated type, as long as the hidden type satisfies said bounds. This has been fixed.
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.
- Windows builds now use profile-guided optimization, providing 10-20% improvements to compiler performance: Utilize PGO for windows x64 rustc dist builds
- Stop keeping metadata in memory before writing it to disk
- compiletest: strip debuginfo by default for mode=ui
- Many improvements to generated code for derives, including performance improvements:
- Bump to clap 3
- fully move dropck to mir
- Optimize
Vec::insertfor the case whereindex == len. - Convert rust-analyzer to an in-tree tool