← Back to all releases

Rust 1.54.0

Released on July 29, 2021

What's Changed

  • [You can now use macros for values in some built-in attributes.][83366]
  • [You can now cast between unsized slice types (and types which contain
  • [You can now use multiple generic lifetimes with impl Trait where the

  • [Rustc will now search for custom JSON targets in
  • [Added wasm as a target_family for WebAssembly platforms.][84072]
  • [You can now use #[target_feature] on safe functions when targeting
  • [Improved debugger output for enums on Windows MSVC platforms.][85292]
  • [Added tier 3\* support for bpfel-unknown-none
  • [-Zmutable-noalias=yes][82834] is enabled by default when using LLVM 12 or above.

  • [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
  • [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]

  • [Added the --prune option to cargo-tree to remove a package from
  • [Added the --depth option to cargo-tree to print only to a certain depth
  • [Added the no-proc-macro value to cargo-tree --edges to hide procedural
  • [A new environment variable named CARGO_TARGET_TMPDIR is available.][cargo/9375]

  • [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
Full Changelog

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:

  #![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.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 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

-------------------

- [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

could require different lifetimes.][85574]

- As previously mentioned the [std::arch intrinsics now uses stricter const checking][83278]

than before and may reject some previously accepted code.

- [i128 multiplication on Cortex M0+ platforms currently unconditionally causes overflow

when compiled with codegen-units = 1.][86063]

[85574]: https://github.com/rust-lang/rust/issues/85574

[86831]: https://github.com/rust-lang/rust/issues/86831

[86063]: https://github.com/rust-lang/rust/issues/86063

[79608]: https://github.com/rust-lang/rust/pull/79608

[84988]: https://github.com/rust-lang/rust/pull/84988

[84701]: https://github.com/rust-lang/rust/pull/84701

[84072]: https://github.com/rust-lang/rust/pull/84072

[85745]: https://github.com/rust-lang/rust/pull/85745

[84744]: https://github.com/rust-lang/rust/pull/84744

[85078]: https://github.com/rust-lang/rust/pull/85078

[84717]: https://github.com/rust-lang/rust/pull/84717

[83800]: https://github.com/rust-lang/rust/pull/83800

[83366]: https://github.com/rust-lang/rust/pull/83366

[83278]: https://github.com/rust-lang/rust/pull/83278

[85292]: https://github.com/rust-lang/rust/pull/85292

[82834]: https://github.com/rust-lang/rust/pull/82834

[cargo/9520]: https://github.com/rust-lang/cargo/pull/9520

[cargo/9499]: https://github.com/rust-lang/cargo/pull/9499

[cargo/9488]: https://github.com/rust-lang/cargo/pull/9488

[cargo/9375]: https://github.com/rust-lang/cargo/pull/9375

[BTreeMap::into_keys]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_keys

[BTreeMap::into_values]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.into_values

[HashMap::into_keys]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_keys

[HashMap::into_values]: https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.into_values

[arch::wasm32]: https://doc.rust-lang.org/core/arch/wasm32/index.html

[VecDeque::binary_search]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search

[VecDeque::binary_search_by]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by

[VecDeque::binary_search_by_key]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.binary_search_by_key

[VecDeque::partition_point]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.partition_point