Rust versions / 1.53
Rust release · Jun 17, 2021
Rust 1.53: what's new, what was stabilized
Short answerRust 1.53 was released on Jun 17, 2021: 37 newly stable APIs (AtomicBool::fetch_update, AtomicPtr::fetch_update, BTreeMap::retain, BTreeSet::retain, ...); 4 compatibility notes that can affect existing code.
← Rust 1.52All versionsRust 1.54 →
37 APIs stabilized
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
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- [Implement token-based handling of attributes during expansion][82608]
- [
Ipv4::from_strwill now reject octal format IP addresses in addition - [The added
BITSconstant may conflict with external definitions.][85667] - Incremental compilation remains off by default, unless one uses the
RUSTC_FORCE_INCREMENTAL=1environment variable added in 1.52.1.
Use it
rustup update stable # get the newest release
rustup install 1.53 # or exactly this one
rustup override set 1.53 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.53" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- [You can now use unicode for identifiers.][83799] 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.][79278] Previously you could only use
|(OR) on complete patterns. E.g. ``rust let x = Some(2u8); // Before matches!(x, Some(1) | Some(2)); // Now matches!(x, Some(1 | 2));`` - [Added the
:pat_parammacro_rules!matcher.][83386] 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.][83387]
- [Added Tier 3\* support for the
wasm64-unknown-unknowntarget.][80525] - [Improved debuginfo for closures and async functions on Windows MSVC.][83941]
\* 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.][81469] - [
slice::IterMut<'_, T>now implementsAsRef<[T]>][82771] - [Arrays of any length now implement
IntoIterator.][84147] 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.][84082] - [
{f32, f64}::from_strnow parse and print special values (NaN,-0) according to IEEE 754.][78618] - [You can now index into slices using
(Bound<usize>, Bound<usize>).][77704] - [Add the
BITSassociated constant to all numeric types.][82565]
Stabilized 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".][cargo/9392] This also includes a switch to the version 3Cargo.lockformat which can handle default branches correctly. - [macOS targets now default to
unpackedsplit-debuginfo.][cargo/9298] - [The
authorsfield is no longer included inCargo.tomlfor new projects.][cargo/9282]
Rustdoc
- [Added the
rustdoc::bare_urlslint that warns when you have URLs without hyperlinks.][81764]
Compatibility Notes
- [Implement token-based handling of attributes during expansion][82608]
- [
Ipv4::from_strwill now reject octal format IP addresses in addition to rejecting hexadecimal IP addresses.][83652] The octal format can lead to confusion and potential security vulnerabilities and [is no longer recommended][ietf6943]. - [The added
BITSconstant may conflict with external definitions.][85667] 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.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.54Released Jul 29, 2021.Read it next →Also worth your time
Did this answer your question?