We are pleased to announce the new version of Rust, 1.7. Rust is a system programming language aimed at safe work with memory, speed and parallel code execution.
As always, you can
install Rust 1.7 from the corresponding page of the official site, as well as see a
detailed list of changes for version 1.7 on Github. This release included 1300 patches.
What is included in the stable version 1.7
This release mainly targets libraries. Although we have several language features that we are preparing for future releases, the period in which version 1.7 was developed included holidays, so people spent less time commenting on GitHub and instead paid attention to their close ones.
Library stabilization
Approximately 40 library functions and methods are stabilized in 1.7. One of the largest stabilized APIs is support for custom hashing algorithms in the standard
HashMap<K, V>
. Previously, all hash dictionaries used
SipHash as a hashing algorithm, which provided protection against default DoS attacks. However, SipHash is
not very fast when hashing small keys.
The FNV algorithm is much faster for such arguments. This means that changing the hashing algorithm for types like
HashMap<usize, V>
can give a significant performance boost if you
Do not need DoS protection.
')
To see this with an example, you can take the
fnv container on
crates.io and create a
HashMap
like this:
extern crate fnv; use std::collections::HashMap; use std::hash::BuildHasherDefault; use fnv::FnvHasher; type MyHasher = BuildHasherDefault<FnvHasher>; fn main() { let mut map: HashMap<_, _, MyHasher> = HashMap::default(); map.insert(1, "Hello"); map.insert(2, ", world!"); println!("{:?}", map); }
Note that most of the time you do not even need to specify the type of hashing algorithm, since type inference will work.
HashMap::default()
is all you need to get hashing that works 2 times faster. It is also worth noting that the
Hash
type is indifferent to a particular hashing algorithm, so no changes in the types stored in the
HashMap
are needed!
Other notable improvements include:
<[T]>::clone_from_slice()
, an efficient way to copy data from one slice to another.- Different methods on
Ipv4Addr
and Ipv6Addr
for convenience, like is_loopback()
, which returns true
or false
depending on whether the address is loopback (address), as described in RFC 6890. - Various improvements in the type of
CString
used in FFI. - Arithmetic operations with checks, with saturation, or with overflow. They are not taken into account in the forty stabilized methods that we cited above. There are a lot of them, but they all do the same thing.
See
the release notes for details.
Cargo features
Made a few small changes to Cargo:
- The build scripts have been [improved] [improvement to build scripts], and now they can accurately inform Cargo of dependencies. Because of this, they are re-executed only when these files are modified.
- [Change
cargo rustc
subcommand] [modification of cargo rustc
subcommand] allows you to specify a profile according to which development time dependencies (dev-dependencies) should be taken during testing, etc.
Participants version 1.7
144 people participated in the development of 1.7. Thank you very much!
List of participants in 1.7