Rust versions / 1.39
Rust release · Nov 7, 2019
Rust 1.39: what's new, what was stabilized
Short answerRust 1.39 was released on Nov 7, 2019: 3 newly stable APIs (Pin::into_inner, Instant::checked_duration_since, Instant::saturating_duration_since); 4 compatibility notes that can affect existing code.
← Rust 1.38All versionsRust 1.40 →
3 APIs stabilized
Pin::into_inner, Instant::checked_duration_since, Instant::saturating_duration_since
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:
- [Code that was previously accepted by the old borrow checker, but rejected by
- [
rustdocnow requiresrustcto be installed and in the same directory to - [The
try!macro will now issue a deprecation warning.][62672] It is - [
asinh(-0.0)now correctly returns-0.0.][63698] Previously this
Use it
rustup update stable # get the newest release
rustup install 1.39 # or exactly this one
rustup override set 1.39 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.39" 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
- [You can now create
asyncfunctions and blocks withasync fn,async move {}, andasync {}respectively, and you can now call.awaiton async expressions.][63209] - [You can now use certain attributes on function, closure, and function pointer parameters.][64010] 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. ``rust 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.][63118] e.g. ```rust 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.][64334] - [Added tier 3 support for the
sparc64-unknown-openbsdtarget.][63595] - [rustc will now trim code snippets in diagnostics to fit in your terminal.][63402] **Note** Cargo currently doesn't use this feature. Refer to [cargo#7315][cargo/7315] to track this feature's progress.
- [You can now pass
--show-outputargument to test binaries to print the output of successful tests.][62600]
\* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
Libraries
- [
Vec::newandString::neware nowconstfunctions.][64028] - [
LinkedList::newis now aconstfunction.][63684] - [
str::len,[T]::lenandstr::as_bytesare nowconstfunctions.][63770] - [The
abs,wrapping_abs, andoverflowing_absnumeric functions are nowconst.][63786]
Stabilized APIs
- [
Pin::into_inner] - [
Instant::checked_duration_since] - [
Instant::saturating_duration_since]
Cargo
- [You can now publish git dependencies if supplied with a
version.][cargo/7237] - [The
--allflag has been renamed to--workspace.][cargo/7241] Using--allis now deprecated.
Misc
- [You can now pass
-Clinkerto rustdoc to control the linker used for compiling doctests.][63834]
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.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.40Released Dec 19, 2019.Read it next →Also worth your time
Did this answer your question?