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).
← 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
CharExtorStrExtmethod directly on core will no longer - [
Debugoutput onatomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize} - [The maximum number for
repr(align(N))is now 2²⁹.][50378] Previously you - The
.description()method on thestd::error::Errortrait
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 itTo 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
procto be used as an identifier. - [The dyn syntax is now available.][49968] This syntax is equivalent to the bare
Traitsyntax, and should make it clearer when being used in tandem withimpl Traitbecause it is equivalent to the following syntax:&Trait == &dyn Trait,&mut Trait == &mut dyn Trait, andBox<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-musleabitarget.][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 calledis_x86_feature_detected!, the#[target_feature(enable="")]attribute, and addingtarget_feature = ""to thecfgattribute. - [A lot of methods for
[u8],f32, andf64previously only available in std are now available in core.][49896] - [The generic
Rhstype parameter onops::{Shl, ShlAssign, Shr}now defaults toSelf.][49630] - [
std::str::replacenow has the#[must_use]attribute][50177] to clarify that the operation isn't done in place. - [
Clone::clone,Iterator::collect, andToOwned::to_ownednow 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-metadatanow includesauthors,categories,keywords,readme, andrepositoryfields.][cargo/5386] - [
cargo-metadatanow includes a package'smetadatatable.][cargo/5360] - [Added the
--target-diroptional argument.][cargo/5393] This allows you to specify a different directory thantargetfor 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=0in 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.orgare now searchable.][49623]
Compatibility Notes
- Calling a
CharExtorStrExtmethod directly on core will no longer work. e.g.::core::prelude::v1::StrExt::is_empty("")will not compile,"".is_empty()will still compile. Debugoutput onatomic::{AtomicBool, AtomicIsize, AtomicPtr, AtomicUsize}will only print the inner type. E.g.print!("{:?}", AtomicBool::new(true))will printtrue, notAtomicBool(true).- The maximum number for
repr(align(N))is now 2²⁹. Previously you could enter higher numbers but they were not supported by LLVM. Up to 512MB alignment should cover all use cases. - The
.description()method on thestd::error::Errortrait has been soft-deprecated. It is no longer required to implement it.
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.
Up next
Next releaseRust 1.28Released Aug 2, 2018.Read it next →Also worth your time
Did this answer your question?