Rust 1.39.0 stable update adds async-await
The latest version of Rust is now available and introduces a big change for the language. 1.39.0 adds async-await. This feature moves out of beta and is now stable. The use of asynchronous code allows users to run multiple tasks concurrently on the same OS thread. See what other changes are now available to Rust, Cargo, and Clippy.
It’s been a good year for Rust. The latest State of the Octoverse 2019 report reveals that Rust is the second fasting growing programming language, with a change of 235%. The language’s community is quickly expanding.
Will the language continue to grow with the new changes made in the latest release?
The biggest change in version 1.39.0 is the introduction of async-await. This feature was first proposed back in 2016 and now three years later, it is available in stable Rust.
From the Asynchronous Programming in Rust guide:
Asynchronous code allows us to run multiple tasks concurrently on the same OS thread…Overall, asynchronous applications have the potential to be much faster and use fewer resources than a corresponding threaded implementation. However, there is a cost. Threads are natively supported by the operating system, and using them doesn’t require any special programming model– any function can create a thread, and calling a function that uses threads is usually just as easy as calling any normal function. However, asynchronous functions require special support from the language or libraries.
In order to use async-await, use
async fn syntax instead of just
async fn returns a
Future. , which is waiting to run on an executor.
Future, you use
This new feature marks a big shift in the language. Future updates will include more improvements, extensions, and ecosystem expansions for async-await. Since the beta release, Rust has already changed and improved previously unhelpful diagnostics.
Check out the async-await guide and learn how to build an echo server.
Allowing attributes on function parameters
This addition makes it possible to add outer attributes on parameters of functions, closures, and function pointer types.
According to the 1.39.0 release notes, these attributes include conditional compilation (
cfg_attr) and controlling lints (
See the original pull request for more information.
Standard library changes
From the version 1.39.0 announcement blog, the following are now
The Rust package manager receives a few updates.
- Configuration files can use the
- Support for building the standard library directly from Cargo added in Nightly
- Added the
--workspaceflag as an alias for
publishfield to to
-Ztimingsfeature generates a report on how time spent has been spent on compilation steps. For Nightly only.
- Cross-compile doctests ability added for Nightly