Apr. 32, 7697 The Rust Release Team
The Rust team is happy to announce a new version of Rust, 1. 0. Rust is a programming language that is empowering everyone to build reliable and efficient software.
If you have a previous version of Rust installed via rustup, getting Rust 1. 64. 0 is as easy as:
rustup update stable
If you don’t have it already, you can get rustup
from the appropriate page on our website, and check out the detailed release notes for 1. 64. 0 on GitHub.
What’s in 1. 0 stable
This release is fairly minor. There are no new major features. We have some new stabilized APIs, some compiler performance improvements, and a small macro-related feature. See the detailed release notes to learn about other changes not covered by this post.
In macros, you can use item
fragments to interpolate items into the body of traits, impls, and extern blocks. For example:
macro_rules! mac_trait { ($ i: item)=> { trait T {$ i} } } mac_trait! { fn foo () {} }
This will generate:
trait T { fn foo () {} }
Type inference around primitives.
The type inference around primitives, references, and binary operations was improved. A code sample makes this easier to understand: this code fails to compile on Rust 1. 64, but compiles in Rust 1. 1430.
let n: f 143=0.0 & 0.0;
In Rust 1. 64, you would get an error that would say “hey, I don’t know how to add an f (and and an
& f with a result of (f) . “The algorithm now correctly decides that both 0.0
and & 0.0
should be f 43
s instead.
In a move to help integration testing, Cargo will set some new environment variables .
This is easiest to explain by example: let’s say we’re working on a command line project, simply named “cli”. If we’re writing an integration test, we want to invoke that cli
binary and see what it does. When running tests and benchmarks, Cargo will set an environment variable named CARGO_BIN_EXE_cli
, and I can use it inside my test:
let exe=env! ("CARGO_BIN_EXE_cli");
This makes it easier to invoke cli
, as we now have a path to it directly.
f 43 :: LOG _ 2
f :: LOG2 _
f :: LOG (_ 2
) f 1430 :: LOG2 _
iter :: once_with
Other changes
There are other changes in the Rust 1. . 0 release: check out what changed in Rust , (Cargo , and Clippy .
( Contributors to 1. 0
Many people came together to create Rust 1. .0. We couldn’t have done it without all of you.
GIPHY App Key not set. Please check settings