Version 1.53.0 (2021-06-17)
Language
- You can now use unicode for identifiers. This allows multilingual
identifiers but still doesn't allow glyphs that are not considered characters
such as
◆or🦀. More specifically you can now use any identifier that matches the UAX #31 "Unicode Identifier and Pattern Syntax" standard. This is the same standard as languages like Python, however Rust uses NFC normalization which may be different from other languages. - You can now specify "or patterns" inside pattern matches.
Previously you could only use
|(OR) on complete patterns. E.g.#![allow(unused)] fn main() { let x = Some(2u8); // Before matches!(x, Some(1) | Some(2)); // Now matches!(x, Some(1 | 2)); } - Added the
:pat_parammacro_rules!matcher. This matcher has the same semantics as the:patmatcher. This is to allow:patto change semantics to being a pattern fragment in a future edition.
Compiler
- Updated the minimum external LLVM version to LLVM 10.
- Added Tier 3* support for the
wasm64-unknown-unknowntarget. - Improved debuginfo for closures and async functions on Windows MSVC.
* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
Libraries
- Abort messages will now forward to
android_set_abort_messageon Android platforms when available. slice::IterMut<'_, T>now implementsAsRef<[T]>- Arrays of any length now implement
IntoIterator. Currently calling.into_iter()as a method on an array will returnimpl Iterator<Item=&T>, but this may change in a future edition to changeItemtoT. CallingIntoIterator::into_iterdirectly on arrays will provideimpl Iterator<Item=T>as expected. leading_zeros, andtrailing_zerosare now available on allNonZerointeger types.{f32, f64}::from_strnow parse and print special values (NaN,-0) according to IEEE 754.- You can now index into slices using
(Bound<usize>, Bound<usize>). - Add the
BITSassociated constant to all numeric types.
Stabilised APIs
AtomicBool::fetch_updateAtomicPtr::fetch_updateBTreeMap::retainBTreeSet::retainBufReader::seek_relativeDebugStruct::non_exhaustiveDuration::MAXDuration::ZERODuration::is_zeroDuration::saturating_addDuration::saturating_mulDuration::saturating_subErrorKind::UnsupportedOption::insertOrdering::is_eqOrdering::is_geOrdering::is_gtOrdering::is_leOrdering::is_ltOrdering::is_neOsStr::is_asciiOsStr::make_ascii_lowercaseOsStr::make_ascii_uppercaseOsStr::to_ascii_lowercaseOsStr::to_ascii_uppercasePeekable::peek_mutRc::decrement_strong_countRc::increment_strong_countVec::extend_from_withinarray::from_mutarray::from_refcmp::max_by_keycmp::max_bycmp::min_by_keycmp::min_byf32::is_subnormalf64::is_subnormal
Cargo
- Cargo now supports git repositories where the default
HEADbranch is not "master". This also includes a switch to the version 3Cargo.lockformat which can handle default branches correctly. - macOS targets now default to
unpackedsplit-debuginfo. - The
authorsfield is no longer included inCargo.tomlfor new projects.
Rustdoc
Compatibility Notes
- Implement token-based handling of attributes during expansion
Ipv4::from_strwill now reject octal format IP addresses in addition to rejecting hexadecimal IP addresses. The octal format can lead to confusion and potential security vulnerabilities and is no longer recommended.- The added
BITSconstant may conflict with external definitions. In particular, this was known to be a problem in thelexical-corecrate, but they have published fixes for semantic versions 0.4 through 0.7. To update this dependency alone, usecargo update -p lexical-core. - Incremental compilation remains off by default, unless one uses the
RUSTC_FORCE_INCREMENTAL=1environment variable added in 1.52.1.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.