Email me

Rust versions / 1.45

Rust release · Jul 16, 2020

Rust 1.45: what's new, what was stabilized

Short answerRust 1.45 was released on Jul 16, 2020: 16 newly stable APIs (Arc::as_ptr, BTreeMap::remove_entry, Rc::as_ptr, rc::Weak::as_ptr, ...); 4 compatibility notes that can affect existing code. Point releases: 1.45.1 (Jul 30, 2020), 1.45.2 (Aug 3, 2020).

Jul 16, 2020release date
0language stabilizations
16APIs stabilized
-new edition

← Rust 1.44All versionsRust 1.46 →

16 APIs stabilized

Arc::as_ptr, BTreeMap::remove_entry, Rc::as_ptr, rc::Weak::as_ptr, rc::Weak::from_raw, rc::Weak::into_raw, str::strip_prefix, str::strip_suffix, sync::Weak::as_ptr, sync::Weak::from_raw, sync::Weak::into_raw, char::UNICODE_VERSION, Span::resolved_at, Span::located_at, Span::mixed_site, unix::process::CommandExt::arg0

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:

  • [Trying to self initialize a static value (that is creating a value using
  • [{f32, f64}::powi now returns a slightly different value on Windows.][73420]
  • [Rustdoc's CLI's extra error exit codes have been removed.][71900] These were
  • [Rustc's lto flag is incompatible with the new embed-bitcode=no.][71848]

Use it

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

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

  • [Out of range float to int conversions using as has been defined as a saturating conversion.][71269] This was previously undefined behaviour, but you can use the {f64, f32}::to_int_unchecked methods to continue using the current behaviour, which may be desirable in rare performance sensitive situations.
  • [mem::Discriminant<T> now uses T's discriminant type instead of always using u64.][70705]
  • [Function like procedural macros can now be used in expression, pattern, and statement positions.][68717] This means you can now use a function-like procedural macro anywhere you can use a declarative (macro_rules!) macro.

Compiler

  • [You can now override individual target features through the target-feature flag.][72094] E.g. -C target-feature=+avx2 -C target-feature=+fma is now equivalent to -C target-feature=+avx2,+fma.
  • [Added the force-unwind-tables flag.][69984] This option allows rustc to always generate unwind tables regardless of panic strategy.
  • [Added the embed-bitcode flag.][71716] This codegen flag allows rustc to include LLVM bitcode into generated rlibs (this is on by default).
  • [Added the tiny value to the code-model codegen flag.][72397]
  • [Added tier 3 support\* for the mipsel-sony-psp target.][72062]
  • [Added tier 3 support for the thumbv7a-uwp-windows-msvc target.][72133]
  • [Upgraded to LLVM 10.][67759]

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

Libraries

  • [net::{SocketAddr, SocketAddrV4, SocketAddrV6} now implements PartialOrd and Ord.][72239]
  • [proc_macro::TokenStream now implements Default.][72234]
  • [You can now use char with ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo} to iterate over a range of codepoints.][72413] E.g. you can now write the following; ``rust for ch in 'a'..='z' { print!("{}", ch); } println!(); // Prints "abcdefghijklmnopqrstuvwxyz" ``
  • [OsString now implements FromStr.][71662]
  • [The saturating_neg method has been added to all signed integer primitive types, and the saturating_abs method has been added for all integer primitive types.][71886]
  • [Arc<T>, Rc<T> now implement From<Cow<'_, T>>, and Box now implements From<Cow> when T is [T: Copy], str, CStr, OsStr, or Path.][71447]
  • [Box<[T]> now implements From<[T; N]>.][71095]
  • [BitOr and BitOrAssign are implemented for all NonZero integer types.][69813]
  • [The fetch_min, and fetch_max methods have been added to all atomic integer types.][72324]
  • [The fetch_update method has been added to all atomic integer types.][71843]

Stabilized APIs

  • [Arc::as_ptr]
  • [BTreeMap::remove_entry]
  • [Rc::as_ptr]
  • [rc::Weak::as_ptr]
  • [rc::Weak::from_raw]
  • [rc::Weak::into_raw]
  • [str::strip_prefix]
  • [str::strip_suffix]
  • [sync::Weak::as_ptr]
  • [sync::Weak::from_raw]
  • [sync::Weak::into_raw]
  • [char::UNICODE_VERSION]
  • [Span::resolved_at]
  • [Span::located_at]
  • [Span::mixed_site]
  • [unix::process::CommandExt::arg0]

Cargo

  • [Cargo uses the embed-bitcode flag to optimize disk usage and build time.][cargo/8066]

Misc

  • [Rustdoc now supports strikethrough text in Markdown.][71928] E.g. ~~outdated information~~ becomes "~~outdated information~~".
  • [Added an emoji to Rustdoc's deprecated API message.][72014]

Compatibility Notes

  • [Trying to self initialize a static value (that is creating a value using itself) is unsound and now causes a compile error.][71140]
  • [{f32, f64}::powi now returns a slightly different value on Windows.][73420] This is due to changes in LLVM's intrinsics which {f32, f64}::powi uses.
  • [Rustdoc's CLI's extra error exit codes have been removed.][71900] These were previously undocumented and not intended for public use. Rustdoc still provides a non-zero exit code on errors.
  • [Rustc's lto flag is incompatible with the new embed-bitcode=no.][71848] This may cause issues if LTO is enabled through RUSTFLAGS or cargo rustc flags while cargo is adding embed-bitcode itself. The recommended way to control LTO is with Cargo profiles, either in Cargo.toml or .cargo/config, or by setting CARGO_PROFILE_<name>_LTO in the environment.

Internals Only

1.45.1 (Jul 30, 2020)

1.45.2 (Aug 3, 2020)

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

← Rust 1.44All versionsRust 1.46 →

Up next

Next releaseRust 1.46Released Aug 27, 2020.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