Rust 1.62.0
Language
- Stabilize
#[derive(Default)]
on enums with a#[default]
variant - Teach flow sensitive checks that visibly uninhabited call expressions never return
- Fix constants not getting dropped if part of a diverging expression
- Support unit struct/enum variant in destructuring assignment
- Remove mutable_borrow_reservation_conflict lint and allow the code pattern
const
functions may now specifyextern "C"
orextern "Rust"
Compiler
- linker: Stop using whole-archive on dependencies of dylibs
- Make
unaligned_references
lint deny-by-default This lint is also a future compatibility lint, and is expected to eventually become a hard error. - Only add codegen backend to dep info if -Zbinary-dep-depinfo is used
- Reject
#[thread_local]
attribute on non-static items - Add tier 3
aarch64-pc-windows-gnullvm
andx86_64-pc-windows-gnullvm
targets* - Implement a lint to warn about unused macro rules
- Promote
x86_64-unknown-none
target to Tier 2*
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
- Windows: Use a pipe relay for chaining pipes
- Replace Linux Mutex and Condvar with futex based ones.
- Replace RwLock by a futex based one on Linux
- std: directly use pthread in UNIX parker implementation
Stabilized APIs
bool::then_some
f32::total_cmp
f64::total_cmp
Stdin::lines
windows::CommandExt::raw_arg
impl<T: Default> Default for AssertUnwindSafe<T>
From<Rc<str>> for Rc<[u8]>
From<Arc<str>> for Arc<[u8]>
FusedIterator for EncodeWide
- RDM intrinsics on aarch64
Clippy
Cargo
- Added the
cargo add
command for adding dependencies toCargo.toml
from the command-line. docs - Package ID specs now support
name@version
syntax in addition to the previousname:version
to align with the behavior incargo add
and other tools.cargo install
andcargo yank
also now support this syntax so the version does not need to passed as a separate flag. - The
git
andregistry
directories in Cargo's home directory (usually~/.cargo
) are now marked as cache directories so that they are not included in backups or content indexing (on Windows). - Added automatic
@
argfile support, which will use "response files" if the command-line torustc
exceeds the operating system's limit.
Compatibility Notes
cargo test
now passes--target
torustdoc
if the specified target is the same as the host target. #10594- rustdoc: doctests are now run on unexported
macro_rules!
macros, matching other private items - rustdoc: Remove .woff font files
- Enforce Copy bounds for repeat elements while considering lifetimes
- Windows: Fix potential unsoundness by aborting if
File
reads or writes cannot complete synchronously.
Internal Changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.