Email me

Rust versions / 1.20

Rust release · Aug 31, 2017

Rust 1.20: what's new, what was stabilized

Short answerRust 1.20 was released on Aug 31, 2017: 34 newly stable APIs (CStr::into_c_string, CString::as_c_str, CString::into_boxed_c_str, Chain::get_mut, ...); 2 compatibility notes that can affect existing code.

Aug 31, 2017release date
0language stabilizations
34APIs stabilized
-new edition

← Rust 1.19All versionsRust 1.21 →

34 APIs stabilized

CStr::into_c_string, CString::as_c_str, CString::into_boxed_c_str, Chain::get_mut, Chain::get_ref, Chain::into_inner, Option::get_or_insert_with, Option::get_or_insert, OsStr::into_os_string, OsString::into_boxed_os_str, Take::get_mut, Take::get_ref, Utf8Error::error_len, char::EscapeDebug, char::escape_debug, compile_error!, f32::from_bits, f32::to_bits, f64::from_bits, f64::to_bits, mem::ManuallyDrop, slice::sort_unstable_by_key, slice::sort_unstable_by, slice::sort_unstable, str::from_boxed_utf8_unchecked, str::as_bytes_mut, str::as_bytes_mut, str::from_utf8_mut, str::from_utf8_unchecked_mut, str::get_mut, str::get_unchecked_mut, str::get_unchecked, str::get, str::into_boxed_bytes

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:

  • [Functions with 'static in their return types will now not be as usable as
  • [The reimplementation of {f32, f64}::is_sign_{negative, positive} now

Use it

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

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

  • [Associated constants are now stabilised.][42809]
  • [A lot of macro bugs are now fixed.][42913]

Compiler

  • [Struct fields are now properly coerced to the expected field type.][42807]
  • [Enabled wasm LLVM backend][42571] WASM can now be built with the wasm32-experimental-emscripten target.
  • [Changed some of the error messages to be more helpful.][42033]
  • [Add support for RELRO(RELocation Read-Only) for platforms that support it.][43170]
  • [rustc now reports the total number of errors on compilation failure][43015] previously this was only the number of errors in the pass that failed.
  • [Expansion in rustc has been sped up 29x.][42533]
  • [added msp430-none-elf target.][43099]
  • [rustc will now suggest one-argument enum variant to fix type mismatch when applicable][43178]
  • [Fixes backtraces on Redox][43228]
  • [rustc now identifies different versions of same crate when absolute paths of different types match in an error message.][42826]

Libraries

  • [Relaxed Debug constraints on {HashMap,BTreeMap}::{Keys,Values}.][42854]
  • [Impl PartialEq, Eq, PartialOrd, Ord, Debug, Hash for unsized tuples.][43011]
  • [Impl fmt::{Display, Debug} for Ref, RefMut, MutexGuard, RwLockReadGuard, RwLockWriteGuard][42822]
  • [Impl Clone for DefaultHasher.][42799]
  • [Impl Sync for SyncSender.][42397]
  • [Impl FromStr for char][42271]
  • [Fixed how {f32, f64}::{is_sign_negative, is_sign_positive} handles NaN.][42431]
  • [allow messages in the unimplemented!() macro.][42155] ie. unimplemented!("Waiting for 1.21 to be stable")
  • [pub(restricted) is now supported in the thread_local! macro.][43185]
  • [Upgrade to Unicode 10.0.0][42999]
  • [Reimplemented {f32, f64}::{min, max} in Rust instead of using CMath.][42430]
  • [Skip the main thread's manual stack guard on Linux][43072]
  • [Iterator::nth for ops::{Range, RangeFrom} is now done in *O*(1) time][43077]
  • [#[repr(align(N))] attribute max number is now 2^31 - 1.][43097] This was previously 2^15.
  • [{OsStr, Path}::Display now avoids allocations where possible][42613]

Stabilized APIs

  • [CStr::into_c_string]
  • [CString::as_c_str]
  • [CString::into_boxed_c_str]
  • [Chain::get_mut]
  • [Chain::get_ref]
  • [Chain::into_inner]
  • [Option::get_or_insert_with]
  • [Option::get_or_insert]
  • [OsStr::into_os_string]
  • [OsString::into_boxed_os_str]
  • [Take::get_mut]
  • [Take::get_ref]
  • [Utf8Error::error_len]
  • [char::EscapeDebug]
  • [char::escape_debug]
  • [compile_error!]
  • [f32::from_bits]
  • [f32::to_bits]
  • [f64::from_bits]
  • [f64::to_bits]
  • [mem::ManuallyDrop]
  • [slice::sort_unstable_by_key]
  • [slice::sort_unstable_by]
  • [slice::sort_unstable]
  • [str::from_boxed_utf8_unchecked]
  • [str::as_bytes_mut]
  • [str::as_bytes_mut]
  • [str::from_utf8_mut]
  • [str::from_utf8_unchecked_mut]
  • [str::get_mut]
  • [str::get_unchecked_mut]
  • [str::get_unchecked]
  • [str::get]
  • [str::into_boxed_bytes]

Cargo

  • [Cargo API token location moved from ~/.cargo/config to ~/.cargo/credentials.][cargo/3978]
  • [Cargo will now build main.rs binaries that are in sub-directories of src/bin.][cargo/4214] ie. Having src/bin/server/main.rs and src/bin/client/main.rs generates target/debug/server and target/debug/client
  • [You can now specify version of a binary when installed through cargo install using --vers.][cargo/4229]
  • [Added --no-fail-fast flag to cargo to run all benchmarks regardless of failure.][cargo/4248]
  • [Changed the convention around which file is the crate root.][cargo/4259]

Compatibility Notes

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

← Rust 1.19All versionsRust 1.21 →

Up next

Next releaseRust 1.21Released Oct 12, 2017.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