Email me

Rust versions / 1.27

Rust release · Jun 21, 2018

Rust 1.27: what's new, what was stabilized

Short answerRust 1.27 was released on Jun 21, 2018: 20 newly stable APIs (DoubleEndedIterator::rfind, DoubleEndedIterator::rfold, DoubleEndedIterator::try_rfold, Duration::from_micros, ...); 4 compatibility notes that can affect existing code. Point releases: 1.27.1 (Jul 10, 2018), 1.27.2 (Jul 20, 2018).

Jun 21, 2018release date
0language stabilizations
20APIs stabilized
-new edition

← Rust 1.26All versionsRust 1.28 →

20 APIs stabilized

DoubleEndedIterator::rfind, DoubleEndedIterator::rfold, DoubleEndedIterator::try_rfold, Duration::from_micros, Duration::from_nanos, Duration::subsec_micros, Duration::subsec_millis, HashMap::remove_entry, Iterator::try_fold, Iterator::try_for_each, NonNull::cast, Option::filter, String::replace_range, Take::set_limit, hint::unreachable_unchecked, os::unix::process::parent_id, ptr::swap_nonoverlapping, slice::rsplit_mut, slice::rsplit, slice::swap_with_slice

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:

  • [Calling a CharExt or StrExt method directly on core will no longer
  • [Debug output on atomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize}
  • [The maximum number for repr(align(N)) is now 2²⁹.][50378] Previously you
  • The .description() method on the std::error::Error trait

Use it

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

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

  • [Removed 'proc' from the reserved keywords list.][49699] This allows proc to be used as an identifier.
  • [The dyn syntax is now available.][49968] This syntax is equivalent to the bare Trait syntax, and should make it clearer when being used in tandem with impl Trait because it is equivalent to the following syntax: &Trait == &dyn Trait, &mut Trait == &mut dyn Trait, and Box<Trait> == Box<dyn Trait>.
  • [Attributes on generic parameters such as types and lifetimes are now stable.][48851] e.g. fn foo<#[lifetime_attr] 'a, #[type_attr] T: 'a>() {}
  • [The #[must_use] attribute can now also be used on functions as well as types.][48925] It provides a lint that by default warns users when the value returned by a function has not been used.

Compiler

  • [Added the armv5te-unknown-linux-musleabi target.][50423]

Libraries

  • [SIMD (Single Instruction Multiple Data) on x86/x86_64 is now stable.][49664] This includes [arch::x86] & [arch::x86_64] modules which contain SIMD intrinsics, a new macro called is_x86_feature_detected!, the #[target_feature(enable="")] attribute, and adding target_feature = "" to the cfg attribute.
  • [A lot of methods for [u8], f32, and f64 previously only available in std are now available in core.][49896]
  • [The generic Rhs type parameter on ops::{Shl, ShlAssign, Shr} now defaults to Self.][49630]
  • [std::str::replace now has the #[must_use] attribute][50177] to clarify that the operation isn't done in place.
  • [Clone::clone, Iterator::collect, and ToOwned::to_owned now have the #[must_use] attribute][49533] to warn about unused potentially expensive allocations.

Stabilized APIs

  • [DoubleEndedIterator::rfind]
  • [DoubleEndedIterator::rfold]
  • [DoubleEndedIterator::try_rfold]
  • [Duration::from_micros]
  • [Duration::from_nanos]
  • [Duration::subsec_micros]
  • [Duration::subsec_millis]
  • [HashMap::remove_entry]
  • [Iterator::try_fold]
  • [Iterator::try_for_each]
  • [NonNull::cast]
  • [Option::filter]
  • [String::replace_range]
  • [Take::set_limit]
  • [hint::unreachable_unchecked]
  • [os::unix::process::parent_id]
  • [ptr::swap_nonoverlapping]
  • [slice::rsplit_mut]
  • [slice::rsplit]
  • [slice::swap_with_slice]

Cargo

  • [cargo-metadata now includes authors, categories, keywords, readme, and repository fields.][cargo/5386]
  • [cargo-metadata now includes a package's metadata table.][cargo/5360]
  • [Added the --target-dir optional argument.][cargo/5393] This allows you to specify a different directory than target for placing compilation artifacts.
  • [Cargo will be adding automatic target inference for binaries, benchmarks, examples, and tests in the Rust 2018 edition.][cargo/5335] If your project specifies specific targets, e.g. using [[bin]], and have other binaries in locations where cargo would infer a binary, Cargo will produce a warning. You can disable this feature ahead of time by setting any of the following to false: autobins, autobenches, autoexamples, autotests.
  • [Cargo will now cache compiler information.][cargo/5359] This can be disabled by setting CARGO_CACHE_RUSTC_INFO=0 in your environment.

Misc

  • [Added “The Rustc book” into the official documentation.][49707] [“The Rustc book”] documents and teaches how to use the rustc compiler.
  • [All books available on doc.rust-lang.org are now searchable.][49623]

Compatibility Notes

1.27.1 (Jul 10, 2018)

Security Notes --------------

  • rustdoc would execute plugins in the /tmp/rustdoc/plugins directory when running, which enabled executing code as some other user on a given machine. This release fixes that vulnerability; you can read more about this on the blog. The associated CVE is CVE-2018-1000622.

Thank you to Red Hat for responsibly disclosing this vulnerability to us.

Compatibility Notes -------------------

  • The borrow checker was fixed to avoid an additional potential unsoundness when using match ergonomics: #51415, #49534.

1.27.2 (Jul 20, 2018)

Compatibility Notes -------------------

  • The borrow checker was fixed to avoid potential unsoundness when using match ergonomics: #52213.

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

← Rust 1.26All versionsRust 1.28 →

Up next

Next releaseRust 1.28Released Aug 2, 2018.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