Email me

Rust versions / 1.54

Rust release · Jul 29, 2021

Rust 1.54: what's new, what was stabilized

Short answerRust 1.54 was released on Jul 29, 2021: 9 newly stable APIs (BTreeMap::into_keys, BTreeMap::into_values, HashMap::into_keys, HashMap::into_values, ...); 4 compatibility notes that can affect existing code.

Jul 29, 2021release date
0language stabilizations
9APIs stabilized
-new edition

← Rust 1.53All versionsRust 1.55 →

9 APIs stabilized

BTreeMap::into_keys, BTreeMap::into_values, HashMap::into_keys, HashMap::into_values, arch::wasm32, VecDeque::binary_search, VecDeque::binary_search_by, VecDeque::binary_search_by_key, VecDeque::partition_point

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:

  • [Mixing Option and Result via ? is no longer permitted in closures for inferred types.][86831]
  • [Previously unsound code is no longer permitted where different constructors in branches
  • As previously mentioned the [std::arch intrinsics now uses stricter const checking][83278]
  • [i128 multiplication on Cortex M0+ platforms currently unconditionally causes overflow

Use it

rustup update stable        # get the newest release
rustup install 1.54          # or exactly this one
rustup override set 1.54     # pin a project to it

To require at least this version from users of your crate, set rust-version = "1.54" 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 macros for values in some built-in attributes.][83366] This primarily allows you to call macros within the #[doc] attribute. For example, to include external documentation in your crate, you can now write the following: ``rust #![doc = include_str!("README.md")] ``
  • [You can now cast between unsized slice types (and types which contain unsized slices) in const fn.][85078]
  • [You can now use multiple generic lifetimes with impl Trait where the lifetimes don't explicitly outlive another.][84701] In code this means that you can now have impl Trait<'a, 'b> where as before you could only have impl Trait<'a, 'b> where 'b: 'a.

Compiler

  • [Rustc will now search for custom JSON targets in /lib/rustlib/<target-triple>/target.json where / is the "sysroot" directory.][83800] You can find your sysroot directory by running rustc --print sysroot.
  • [Added wasm as a target_family for WebAssembly platforms.][84072]
  • [You can now use #[target_feature] on safe functions when targeting WebAssembly platforms.][84988]
  • [Improved debugger output for enums on Windows MSVC platforms.][85292]
  • [Added tier 3\* support for bpfel-unknown-none and bpfeb-unknown-none.][79608]
  • [-Zmutable-noalias=yes][82834] is enabled by default when using LLVM 12 or above.

\* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

  • [panic::panic_any will now #[track_caller].][85745]
  • [Added OutOfMemory as a variant of io::ErrorKind.][84744]
  • [ proc_macro::Literal now implements FromStr.][84717]
  • [The implementations of vendor intrinsics in core::arch have been significantly refactored.][83278] The main user-visible changes are a 50% reduction in the size of libcore.rlib and stricter validation of constant operands passed to intrinsics. The latter is technically a breaking change, but allows Rust to more closely match the C vendor intrinsics API.

Stabilized APIs

  • [BTreeMap::into_keys]
  • [BTreeMap::into_values]
  • [HashMap::into_keys]
  • [HashMap::into_values]
  • [arch::wasm32]
  • [VecDeque::binary_search]
  • [VecDeque::binary_search_by]
  • [VecDeque::binary_search_by_key]
  • [VecDeque::partition_point]

Cargo

  • [Added the --prune <spec> option to cargo-tree to remove a package from the dependency graph.][cargo/9520]
  • [Added the --depth option to cargo-tree to print only to a certain depth in the tree ][cargo/9499]
  • [Added the no-proc-macro value to cargo-tree --edges to hide procedural macro dependencies.][cargo/9488]
  • [A new environment variable named CARGO_TARGET_TMPDIR is available.][cargo/9375] This variable points to a directory that integration tests and benches can use as a "scratchpad" for testing filesystem operations.

Compatibility Notes

Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.

← Rust 1.53All versionsRust 1.55 →

Up next

Next releaseRust 1.55Released Sep 9, 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