Email me

Rust versions / 1.50

Rust release · Feb 11, 2021

Rust 1.50: what's new, what was stabilized

Short answerRust 1.50 was released on Feb 11, 2021: 37 newly stable APIs (bool::then, btree_map::Entry::or_insert_with_key, f32::clamp, f64::clamp, ...); 6 compatibility notes that can affect existing code.

Feb 11, 2021release date
0language stabilizations
37APIs stabilized
-new edition

← Rust 1.49All versionsRust 1.51 →

37 APIs stabilized

bool::then, btree_map::Entry::or_insert_with_key, f32::clamp, f64::clamp, hash_map::Entry::or_insert_with_key, Ord::clamp, RefCell::take, slice::fill, UnsafeCell::get_mut, IpAddr::is_ipv4, IpAddr::is_ipv6, IpAddr::is_unspecified, IpAddr::is_loopback, IpAddr::is_multicast, Ipv4Addr::octets, Ipv4Addr::is_loopback, Ipv4Addr::is_private, Ipv4Addr::is_link_local, Ipv4Addr::is_multicast, Ipv4Addr::is_broadcast, Ipv4Addr::is_documentation, Ipv4Addr::to_ipv6_compatible, Ipv4Addr::to_ipv6_mapped, Ipv6Addr::segments, Ipv6Addr::is_unspecified, Ipv6Addr::is_loopback, Ipv6Addr::is_multicast, Ipv6Addr::to_ipv4, Layout::size, Layout::align, Layout::from_size_align, pow, checked_pow, saturating_pow, wrapping_pow, next_power_of_two, checked_next_power_of_two

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:

  • [The compare_and_swap method on atomics has been deprecated.][79261] It's
  • [Changes in how TokenStreams are checked have fixed some cases where you could write
  • [#![test] as an inner attribute is now considered unstable like other inner macro
  • [Overriding a forbid lint at the same level that it was set is now a hard error.][78864]
  • [You can no longer intercept panic! calls by supplying your own macro.][78343] It's
  • [Semi-colons after item statements (e.g. struct Foo {};) now produce a warning.][78296]

Use it

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

To require at least this version from users of your crate, set rust-version = "1.50" 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 const values for x in [x; N] array expressions.][79270] This has been technically possible since 1.38.0, as it was unintentionally stabilized.
  • [Assignments to ManuallyDrop<T> union fields are now considered safe.][78068]

Compiler

  • [Added tier 3\* support for the armv5te-unknown-linux-uclibceabi target.][78142]
  • [Added tier 3 support for the aarch64-apple-ios-macabi target.][77484]
  • [The x86_64-unknown-freebsd is now built with the full toolset.][79484]
  • [Dropped support for all cloudabi targets.][78439]

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

Libraries

  • [proc_macro::Punct now implements PartialEq<char>.][78636]
  • [ops::{Index, IndexMut} are now implemented for fixed sized arrays of any length.][74989]
  • [On Unix platforms, the std::fs::File type now has a "niche" of -1.][74699] This value cannot be a valid file descriptor, and now means Option<File> takes up the same amount of space as File.

Stabilized APIs

  • [bool::then]
  • [btree_map::Entry::or_insert_with_key]
  • [f32::clamp]
  • [f64::clamp]
  • [hash_map::Entry::or_insert_with_key]
  • [Ord::clamp]
  • [RefCell::take]
  • [slice::fill]
  • [UnsafeCell::get_mut]

The following previously stable methods are now const.

  • [IpAddr::is_ipv4]
  • [IpAddr::is_ipv6]
  • [IpAddr::is_unspecified]
  • [IpAddr::is_loopback]
  • [IpAddr::is_multicast]
  • [Ipv4Addr::octets]
  • [Ipv4Addr::is_loopback]
  • [Ipv4Addr::is_private]
  • [Ipv4Addr::is_link_local]
  • [Ipv4Addr::is_multicast]
  • [Ipv4Addr::is_broadcast]
  • [Ipv4Addr::is_documentation]
  • [Ipv4Addr::to_ipv6_compatible]
  • [Ipv4Addr::to_ipv6_mapped]
  • [Ipv6Addr::segments]
  • [Ipv6Addr::is_unspecified]
  • [Ipv6Addr::is_loopback]
  • [Ipv6Addr::is_multicast]
  • [Ipv6Addr::to_ipv4]
  • [Layout::size]
  • [Layout::align]
  • [Layout::from_size_align]
  • pow for all integer types.
  • checked_pow for all integer types.
  • saturating_pow for all integer types.
  • wrapping_pow for all integer types.
  • next_power_of_two for all unsigned integer types.
  • checked_next_power_of_two for all unsigned integer types.

Cargo

  • [Added the [build.rustc-workspace-wrapper] option.][cargo/8976] This option sets a wrapper to execute instead of rustc, for workspace members only.
  • [cargo:rerun-if-changed will now, if provided a directory, scan the entire contents of that directory for changes.][cargo/8973]
  • [Added the --workspace flag to the cargo update command.][cargo/8725]

Misc

  • [The search results tab and the help button are focusable with keyboard in rustdoc.][79896]
  • [Running tests will now print the total time taken to execute.][75752]

Compatibility Notes

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

← Rust 1.49All versionsRust 1.51 →

Up next

Next releaseRust 1.51Released Mar 25, 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