Version 1.39.0 (2019-11-07)
Language
- You can now create
asyncfunctions and blocks withasync fn,async move {}, andasync {}respectively, and you can now call.awaiton async expressions. - You can now use certain attributes on function, closure, and function pointer
parameters. These attributes include
cfg,cfg_attr,allow,warn,deny,forbidas 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
ifguards ofmatcharms. 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-uefitarget. - Added tier 3 support for the
sparc64-unknown-openbsdtarget. - 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-outputargument 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::newandString::neware nowconstfunctions.LinkedList::newis now aconstfunction.str::len,[T]::lenandstr::as_bytesare nowconstfunctions.- The
abs,wrapping_abs, andoverflowing_absnumeric functions are nowconst.
Stabilized APIs
Cargo
- You can now publish git dependencies if supplied with a
version. - The
--allflag has been renamed to--workspace. Using--allis 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.
rustdocnow requiresrustcto 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.