Version 1.39.0 (2019-11-07)
Language
- You can now create
async
functions and blocks withasync fn
,async move {}
, andasync {}
respectively, and you can now call.await
on async expressions. - You can now use certain attributes on function, closure, and function pointer
parameters. These attributes include
cfg
,cfg_attr
,allow
,warn
,deny
,forbid
as well as inert helper attributes used by procedural macro attributes applied to items. e.g.#![allow(unused)] fn main() { fn len( #[cfg(windows)] slice: &[u16], #[cfg(not(windows))] slice: &[u8], ) -> usize { slice.len() } }
- You can now take shared references to bind-by-move patterns in the
if
guards ofmatch
arms. e.g.fn main() { let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]); match array { nums // ---- `nums` is bound by move. if nums.iter().sum::<u8>() == 10 // ^------ `.iter()` implicitly takes a reference to `nums`. => { drop(nums); // ----------- Legal as `nums` was bound by move and so we have ownership. } _ => unreachable!(), } }
Compiler
- Added tier 3* support for the
i686-unknown-uefi
target. - Added tier 3 support for the
sparc64-unknown-openbsd
target. - rustc will now trim code snippets in diagnostics to fit in your terminal. Note Cargo currently doesn't use this feature. Refer to cargo#7315 to track this feature's progress.
- You can now pass
--show-output
argument to test binaries to print the output of successful tests.
* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
Libraries
Vec::new
andString::new
are nowconst
functions.LinkedList::new
is now aconst
function.str::len
,[T]::len
andstr::as_bytes
are nowconst
functions.- The
abs
,wrapping_abs
, andoverflowing_abs
numeric functions are nowconst
.
Stabilized APIs
Cargo
- You can now publish git dependencies if supplied with a
version
. - The
--all
flag has been renamed to--workspace
. Using--all
is now deprecated.
Misc
Compatibility Notes
- Code that was previously accepted by the old borrow checker, but rejected by the NLL borrow checker is now a hard error in Rust 2018. This was previously a warning, and will also become a hard error in the Rust 2015 edition in the 1.40.0 release.
rustdoc
now requiresrustc
to be installed and in the same directory to run tests. This should improve performance when running a large amount of doctests.- The
try!
macro will now issue a deprecation warning. It is recommended to use the?
operator instead. asinh(-0.0)
now correctly returns-0.0
. Previously this returned0.0
.