Update Jun 17, 2021 tracked by Updatify
Rust 1.53.0
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.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 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_update -
AtomicPtr::fetch_update -
BTreeMap::retain -
BTreeSet::retain -
BufReader::seek_relative -
DebugStruct::non_exhaustive -
Duration::MAX -
Duration::ZERO -
Duration::is_zero -
Duration::saturating_add -
Duration::saturating_mul -
Duration::saturating_sub -
ErrorKind::Unsupported -
Option::insert -
Ordering::is_eq -
Ordering::is_ge -
Ordering::is_gt -
Ordering::is_le -
Ordering::is_lt -
Ordering::is_ne -
OsStr::is_ascii -
OsStr::make_ascii_lowercase -
OsStr::make_ascii_uppercase -
OsStr::to_ascii_lowercase -
OsStr::to_ascii_uppercase -
Peekable::peek_mut -
Rc::decrement_strong_count -
Rc::increment_strong_count -
Vec::extend_from_within -
array::from_mut -
array::from_ref -
cmp::max_by_key -
cmp::max_by -
cmp::min_by_key -
cmp::min_by -
f32::is_subnormal -
f64::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.