The Rust team is happy to announce the latest version of Rust, 1.14.0. Rust is a systems programming language focused on safety, speed, and concurrency.
As always, you can install Rust 1.14.0 from the appropriate page on our website, and check out the detailed release notes for 1.14.0 on GitHub. 1230 patches were landed in this release.
What's in 1.14.0 stable
One of the biggest features in Rust 1.14 isn't actually in the language or compiler: the rustup tool has reached a 1.0 release, and is now the recommended way to install Rust from the project directly. Rustup does a bit more than just install Rust:
rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes cross-compiling simpler with binary builds of the standard library for common platforms. And it runs on all platforms Rust supports, including Windows.
We had a previous post about Rustup back in May. You can learn more about it there, or by checking it out on GitHub.
Another exciting feature is experimental support for WebAssembly as a
target, wasm32-unknown-emscripten
. It is still early days, and there's a lot
of bugs to shake out, so please give it a try and report them! To give you a
small taste of how it works, once you have emscripten installed, compiling
some Rust code to WebAssembly is as easy as:
$ rustup target add wasm32-unknown-emscripten
$ echo 'fn main() { println!("Hello, Emscripten!"); }' > hello.rs
$ rustc --target=wasm32-unknown-emscripten hello.rs
$ node hello.js
The community has been doing interesting, experimental work in this area: see Jan-Erik's slides for the workshop he ran at Rust Belt Rust for some examples, or check out Tim's example of the classic TodoMVC project. This implementation builds off of his webplatform crate, which exposes the DOM to Rust.
Speaking of platforms, a large number of platforms have gained additional support:
For rustc
:
mips-unknown-linux-gnu
mipsel-unknown-linux-gnu
mips64-unknown-linux-gnuabi64
mips64el-unknown-linux-gnuabi64
powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
s390x-unknown-linux-gnu
And for std
:
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armv7-unknown-linux-musleabihf
If you're using one of these platforms, follow the instructions on the website
to install, or add the targets to an existing installation with
rustup target add
.
These platforms are all 'tier 2', please see our page on platform support for more details.
Just like how the community is doing interesting work on the WebAssembly target, there's also neat things going on with increasing Rust's target support beyond what's listed above. xargo allows for easy cross-compilation of Rust to bare-metal targets. If you're writing an operating system in Rust, or doing something interesting on a microcontroller, xargo can make your life a lot simpler.
The landing of MIR over the last few releases means that a number of improvements to compile times have landed, with more coming in the future.
In the language, one small improvement has landed: support for RFC 1492. This small
addition lets you use ..
in more places. Previously, say you had a struct like this:
struct Point {
x: i32,
y: i32,
z: i32,
}
In any context where you're doing a pattern match, you could use ..
to ignore the
parts you don't care about. For example:
let p = Point { x: 0, y: 1, z: 2 };
match p {
Point { x, .. } => println!("x is {}", x),
}
The ..
ignores y
and z
.
Consider a similar Point
, but as a tuple struct:
struct Point(i32, i32, i32);
Previously, you could use ..
to ignore all three elements:
let p = Point(0, 1, 2);
match p {
Point(..) => println!("found a point"),
}
But you could not use it to only ignore parts of the tuple:
let p = Point(0, 1, 2);
match p {
Point(x, ..) => println!("x is {}", x),
}
This was an inconsistency, and so with RFC 1492 stabilized, compiles fine as of this release. This applies to more situations than tuples; please see the RFC for more details.
Library stabilizations
There have been a number of additions to the standard library, but they don't fit into particularly nice categories for this release. Here's the highlights:
println!()
, with no arguments, prints newline. Previously, an empty string was required to achieve the same.Wrapping
impls standard binary and unary operators on references, as well as theSum
andProduct
iterators, making references to these types easier to use.- Implement
From<Cow<str>> for String
andFrom<Cow<[T]>> for Vec<T>
. These implementations make sense, but were not yet added. - Expand
.zip()
specialization to.map()
and.cloned()
for improved performance. - Implement
RefUnwindSafe
for atomic types, as these types are "unwind safe," though that wasn't obvious at first. - Specialize
Vec::extend
toVec::extend_from_slice
for performance gains. - Don't reuse
HashMap
random seeds. This helps to mitigate one type of DDoS attack. - The internal memory layout of
HashMap
is more cache-friendly, for significant improvements in some operations - Impl
Add<{str, Cow<str>}>
forCow<str>
. We already supportAdd
for other string types, so not having it onCow
is inconsistent.
See the detailed release notes for more.
Cargo features
As for Cargo, RFC 1721 has been implemented. Cargo will now pass along the
values printed by rustc --print cfg
to build scripts. The motivation for this
feature is that Cargo can now compile objects for statically linking against
the msvcrt on the MSVC platform.
Cargo now works properly with a read-only CARGO_HOME
.
Finally, Cargo will ignore the panic
configuration for the test
and
bench
profiles. This is important because the test runner relies on
panics counting as failing tests, and so with panic=abort
, a failing test
would abort the entire test suite.
See the detailed release notes for more.
Contributors to 1.14.0
We had 144 individuals contribute to 1.14.0. Thank you so much!
- Abhishek Chanda
- Adam Perry
- Ahmed Charles
- Aidan Hobson Sayers
- Aleksey Kladov
- Alexander von Gluck IV
- Alex Burka
- Alex Crichton
- Alex von Gluck IV
- Amanieu d'Antras
- Andrea Corradi
- Andrea Pretto
- Andreas Sommer
- Andre Bogus
- Andrew Paseltiner
- angelsl
- Anthony Ramine
- Ariel Ben-Yehuda
- arthurprs
- Austin Hicks
- bors
- Brian Anderson
- Bunts Thy Unholy
- CensoredUsername
- Chris McDonald
- Christopher
- christopherdumas
- Christopher Serr
- Cobrand
- Corey Farwell
- Cristi Cobzarenco
- Daan Sprenkels
- Danny Hua
- David Henningsson
- Devon Hollowood
- Dmitry Gritsay
- Dominik Inführ
- Duncan
- Eduard Burtescu
- Eduard-Mihai Burtescu
- Eric Roshan-Eisner
- est31
- Fabian Frei
- Federico Mena Quintero
- Felix S. Klock II
- Florian Diebold
- Florian Hartwig
- Florian Zeitz
- Frank Rehberger
- Gavin Baker
- Geoffry Song
- Guillaume Gomez
- iirelu
- James Miller
- Jan-Erik Rediger
- Jared Roesch
- Jeffrey Seyfried
- Jesus Garlea
- Jethro Beekman
- Joe Neeman
- Johannes Muenzel
- John Firebaugh
- John Hodge
- johnthagen
- Jonas Schievink
- Jonathan Turner
- Jorge Aparicio
- Josh Stone
- Josh Triplett
- Keegan McAllister
- Keith Yeung
- KillTheMule
- Konrad Borowski
- leonardo.yvens
- Liigo Zhuang
- loggerhead
- Manish Goregaokar
- Marcin Fatyga
- Mark-Simulacrum
- Martin Glagla
- Martin Thoresen
- Mathieu Borderé
- Mathieu Poumeyrol
- Matt Brubeck
- Matthew Piziak
- Matwey V. Kornilov
- mcarton
- Michael Woerister
- Mikhail Modin
- Mikko Rantanen
- msiglreith
- Nabeel Omer
- Nathan Musoke
- Nicholas Nethercote
- Nick Cameron
- Nick Fitzgerald
- Nick Stevens
- Nikhil Shagrithaya
- Niko Matsakis
- Oliver Middleton
- p512
- ParkHanbum
- Paul Lange
- Paulo Matos
- Paul Osborne
- Peter Atashian
- Peter N
- Philip Davis
- Pieter Frenssen
- Pweaver (Paul Weaver)
- pweyck
- QuietMisdreavus
- Raph Levien
- Razican
- Robin Stocker
- Ross Schulman
- Ryan Senior
- Scott Olson
- Seo Sanghyeon
- Simonas Kazlauskas
- Simon Sapin
- Srinivas Reddy Thatiparthy
- Stefan Schindler
- Stephen M. Coakley
- Steve Klabnik
- Steven Fackler
- Tamir Duberstein
- Taylor Cramer
- Tim Neumann
- Tobias Bucher
- Tomasz Miąsko
- tormol
- Tshepang Lekhonkhobe
- Ulrik Sverdrup
- Vadim Chugunov
- Vadim Petrochenkov
- Vadzim Dambrouski
- Vangelis Katsikaros
- Wang Xuerui
- Wesley Wiser
- Zack M. Davis
- Zoffix Znet
- Артём Павлов [Artyom Pavlov]
- 石博文