Email me

Rust versions / 1.59

Rust release · Feb 24, 2022

Rust 1.59: what's new, what was stabilized

Short answerRust 1.59 was released on Feb 24, 2022: 3 language stabilizations ([Stabilize default arguments for const parameters and remove the ordering restriction for ...); 25 newly stable APIs (std::thread::available_parallelism, Result::copied, Result::cloned, arch::asm!, ...); 9 compatibility notes that can affect existing code.

Feb 24, 2022release date
3language stabilizations
25APIs stabilized
-new edition

← Rust 1.58All versionsRust 1.60 →

Language features stabilized

  • [Stabilize default arguments for const parameters and remove the ordering restriction for type and const parameters][90207]
  • [Stabilize destructuring assignment][90521]
  • [Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64, and RISC-V][91728]

25 APIs stabilized

std::thread::available_parallelism, Result::copied, Result::cloned, arch::asm!, arch::global_asm!, ops::ControlFlow::is_break, ops::ControlFlow::is_continue, TryFrom<char> for u8, char::TryFromCharError, iter::zip, NonZeroU8::is_power_of_two, NonZeroU16::is_power_of_two, NonZeroU32::is_power_of_two, NonZeroU64::is_power_of_two, NonZeroU128::is_power_of_two, NonZeroUsize::is_power_of_two, DoubleEndedIterator for ToLowercase, DoubleEndedIterator for ToUppercase, TryFrom<&mut [T]> for [T; N], UnwindSafe for Once, RefUnwindSafe for Once, mem::MaybeUninit::as_ptr, mem::MaybeUninit::assume_init, mem::MaybeUninit::assume_init_ref, ffi::CStr::from_bytes_with_nul_unchecked

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:

  • [Refactor weak symbols in std::sys::unix][90846]
  • [Deprecate crate_type and crate_name nested inside #![cfg_attr]][83744]
  • [Remove effect of #[no_link] attribute on name resolution][92034]
  • [Cargo will document libraries before binaries.][cargo/10172]
  • [Respect doc=false in dependencies, not just the root crate][cargo/10201]
  • [Weaken guarantee around advancing underlying iterators in zip][83791]
  • [Make split_inclusive() on an empty slice yield an empty output][89825]
  • [Update std::env::temp_dir to use GetTempPath2 on Windows when available.][89999]
  • [unreachable! was updated to match other formatting macro behavior on Rust 2021][92137]

Use it

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

To require at least this version from users of your crate, set rust-version = "1.59" 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

  • [Stabilize default arguments for const parameters and remove the ordering restriction for type and const parameters][90207]
  • [Stabilize destructuring assignment][90521]
  • [Relax private in public lint on generic bounds and where clauses of trait impls][90586]
  • [Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64, and RISC-V][91728]

Compiler

  • [Stabilize new symbol mangling format, leaving it opt-in (-Csymbol-mangling-version=v0)][90128]
  • [Emit LLVM optimization remarks when enabled with -Cremark][90833]
  • [Fix sparc64 ABI for aggregates with floating point members][91003]
  • [Warn when a #[test]-like built-in attribute macro is present multiple times.][91172]
  • [Add support for riscv64gc-unknown-freebsd][91284]
  • [Stabilize -Z emit-future-incompat as --json future-incompat][91535]
  • Soft disable incremental compilation

This release disables incremental compilation, unless the user has explicitly opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable. This is due to a known and relatively frequently occurring bug in incremental compilation, which causes builds to issue internal compiler errors. This particular bug is already fixed on nightly, but that fix has not yet rolled out to stable and is deemed too risky for a direct stable backport.

As always, we encourage users to test with nightly and report bugs so that we can track failures and fix issues earlier.

See 94124 for more details.

Libraries

  • [Remove unnecessary bounds for some Hash{Map,Set} methods][91593]

Stabilized APIs

  • [std::thread::available_parallelism][available_parallelism]
  • [Result::copied][result-copied]
  • [Result::cloned][result-cloned]
  • [arch::asm!][asm]
  • [arch::global_asm!][global_asm]
  • [ops::ControlFlow::is_break][is_break]
  • [ops::ControlFlow::is_continue][is_continue]
  • [TryFrom<char> for u8][try_from_char_u8]
  • [char::TryFromCharError][try_from_char_err] implementing Clone, Debug, Display, PartialEq, Copy, Eq, Error
  • [iter::zip][zip]
  • [NonZeroU8::is_power_of_two][is_power_of_two8]
  • [NonZeroU16::is_power_of_two][is_power_of_two16]
  • [NonZeroU32::is_power_of_two][is_power_of_two32]
  • [NonZeroU64::is_power_of_two][is_power_of_two64]
  • [NonZeroU128::is_power_of_two][is_power_of_two128]
  • [NonZeroUsize::is_power_of_two][is_power_of_two_usize]
  • [DoubleEndedIterator for ToLowercase][lowercase]
  • [DoubleEndedIterator for ToUppercase][uppercase]
  • [TryFrom<&mut [T]> for [T; N]][tryfrom_ref_arr]
  • [UnwindSafe for Once][unwindsafe_once]
  • [RefUnwindSafe for Once][refunwindsafe_once]
  • [armv8 neon intrinsics for aarch64][stdarch/1266]

Const-stable:

  • [mem::MaybeUninit::as_ptr][muninit_ptr]
  • [mem::MaybeUninit::assume_init][muninit_init]
  • [mem::MaybeUninit::assume_init_ref][muninit_init_ref]
  • [ffi::CStr::from_bytes_with_nul_unchecked][cstr_from_bytes]

Cargo

  • [Stabilize the strip profile option][cargo/10088]
  • [Stabilize future-incompat-report][cargo/10165]
  • [Support abbreviating --release as -r][cargo/10133]
  • [Support term.quiet configuration][cargo/10152]
  • [Remove --host from cargo {publish,search,login}][cargo/10145]

Compatibility Notes

  • [Refactor weak symbols in std::sys::unix][90846] This may add new, versioned, symbols when building with a newer glibc, as the standard library uses weak linkage rather than dynamically attempting to load certain symbols at runtime.
  • [Deprecate crate_type and crate_name nested inside #![cfg_attr]][83744] This adds a future compatibility lint to supporting the use of cfg_attr wrapping either crate_type or crate_name specification within Rust files; it is recommended that users migrate to setting the equivalent command line flags.
  • [Remove effect of #[no_link] attribute on name resolution][92034] This may expose new names, leading to conflicts with preexisting names in a given namespace and a compilation failure.
  • [Cargo will document libraries before binaries.][cargo/10172]
  • [Respect doc=false in dependencies, not just the root crate][cargo/10201]
  • [Weaken guarantee around advancing underlying iterators in zip][83791]
  • [Make split_inclusive() on an empty slice yield an empty output][89825]
  • [Update std::env::temp_dir to use GetTempPath2 on Windows when available.][89999]
  • [unreachable! was updated to match other formatting macro behavior on Rust 2021][92137]

Internal Changes

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.58All versionsRust 1.60 →

Up next

Next releaseRust 1.60Released Apr 7, 2022.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