Email me

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.

Jun 17, 2021release date
0language stabilizations
37APIs stabilized
-new edition

← 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_str will now reject octal format IP addresses in addition
  • [The added BITS constant may conflict with external definitions.][85667]
  • Incremental compilation remains off by default, unless one uses the RUSTC_FORCE_INCREMENTAL=1 environment 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 it

To 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_param macro_rules! matcher.][83386] This matcher has the same semantics as the :pat matcher. This is to allow :pat to 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-unknown target.][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_message on Android platforms when available.][81469]
  • [slice::IterMut<'_, T> now implements AsRef<[T]>][82771]
  • [Arrays of any length now implement IntoIterator.][84147] Currently calling .into_iter() as a method on an array will return impl Iterator<Item=&T>, but this may change in a future edition to change Item to T. Calling IntoIterator::into_iter directly on arrays will provide impl Iterator<Item=T> as expected.
  • [leading_zeros, and trailing_zeros are now available on all NonZero integer types.][84082]
  • [{f32, f64}::from_str now 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 BITS associated 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 HEAD branch is not "master".][cargo/9392] This also includes a switch to the version 3 Cargo.lock format which can handle default branches correctly.
  • [macOS targets now default to unpacked split-debuginfo.][cargo/9298]
  • [The authors field is no longer included in Cargo.toml for new projects.][cargo/9282]

Rustdoc

  • [Added the rustdoc::bare_urls lint that warns when you have URLs without hyperlinks.][81764]

Compatibility Notes

  • [Implement token-based handling of attributes during expansion][82608]
  • [Ipv4::from_str will 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 BITS constant may conflict with external definitions.][85667] In particular, this was known to be a problem in the lexical-core crate, but they have published fixes for semantic versions 0.4 through 0.7. To update this dependency alone, use cargo update -p lexical-core.
  • Incremental compilation remains off by default, unless one uses the RUSTC_FORCE_INCREMENTAL=1 environment 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.

← Rust 1.52All versionsRust 1.54 →

Up next

Next releaseRust 1.54Released Jul 29, 2021.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ