|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Announcing Rust 1.7" |
| 4 | +author: The Rust Core Team |
| 5 | +--- |
| 6 | + |
| 7 | +The Rust team is happy to announce the latest version of Rust, 1.7. Rust is a |
| 8 | +systems programming language focused on safety, speed, and concurrency. |
| 9 | + |
| 10 | +As always, you can [install Rust 1.7][install] from the appropriate page on our |
| 11 | +website, and check out the [detailed release notes for 1.7][notes] on GitHub. |
| 12 | +About 1300 patches were landed in this release. |
| 13 | + |
| 14 | +[install]: https://www.rust-lang.org/install.html |
| 15 | +[notes]: https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-170-2016-03-03 |
| 16 | + |
| 17 | +### What's in 1.7 stable |
| 18 | + |
| 19 | +This release is primarily about library features. While we have several |
| 20 | +language features cooking for future releases, the timeframe in which 1.7 was |
| 21 | +developed included the holidays, which means less time for commenting on GitHub |
| 22 | +and more time for spending with loved ones. |
| 23 | + |
| 24 | +#### Library stabilizations |
| 25 | + |
| 26 | +About 40 library functions and methods are now stable in 1.7. One of the |
| 27 | +largest APIs stabilized was support for custom hash algorithms in the standard |
| 28 | +library’s `HashMap<K, V>` type. Previously all hash maps would use [SipHash] as |
| 29 | +the hashing algorithm, which provides protection against DOS attacks by |
| 30 | +default. SipHash, however, is [not very fast] at hashing small keys. As shown, |
| 31 | +however, the [FNV hash algorithm] is much faster for these size of inputs. This |
| 32 | +means that by switching hash algorithms for types like `HashMap<usize, V>` |
| 33 | +there can be a significant speedup so long as the loss of DOS protection is |
| 34 | +acceptable. |
| 35 | + |
| 36 | +[Siphash]: https://en.wikipedia.org/wiki/SipHash |
| 37 | +[not very fast]: http://cglab.ca/~abeinges/blah/hash-rs/ |
| 38 | +[FNV hash algorithm]: https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function |
| 39 | + |
| 40 | +To see this in action, you can check out the [fnv crate] on [crates.io] and |
| 41 | +create a `HashMap` via: |
| 42 | + |
| 43 | +```rust |
| 44 | +extern crate fnv; |
| 45 | + |
| 46 | +use std::collections::HashMap; |
| 47 | +use std::hash::BuildHasherDefault; |
| 48 | +use fnv::FnvHasher; |
| 49 | + |
| 50 | +type MyHasher = BuildHasherDefault<FnvHasher>; |
| 51 | + |
| 52 | +fn main() { |
| 53 | + let mut map: HashMap<_, _, MyHasher> = HashMap::default(); |
| 54 | + map.insert(1, "Hello"); |
| 55 | + map.insert(2, ", world!"); |
| 56 | + println!("{:?}", map); |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +[fnv crate]: https://crates.io/crates/fnv |
| 61 | +[crates.io]: https://crates.io |
| 62 | + |
| 63 | + |
| 64 | +Note that most of the time you don’t even need to specify the hasher as type |
| 65 | +inference will take care of it, so `HashMap::default()` should be all you need |
| 66 | +to get up to 2x faster hashes. It’s also worth pointing out that [`Hash`] trait |
| 67 | +is agnostic to the hashing algorithm used, so no changes are needed to the |
| 68 | +types being inserted into hash maps to reap the benefits! |
| 69 | + |
| 70 | +[`Hash`]: http://doc.rust-lang.org/std/hash/trait.Hash.html |
| 71 | + |
| 72 | +Other notable improvements include: |
| 73 | + |
| 74 | +* `<[T]>::clone_from_slice()`, an efficient way to copy the data from one slice |
| 75 | + and put it into another slice. |
| 76 | +* Various convenience methods on `Ipv4Addr` and `Ipv6Addr`, such as `is_loopback()`, |
| 77 | + which returns `true` or `false` if the address is a loopback address according to |
| 78 | + RFC 6890. |
| 79 | +* Various improvements to `CString`, used for FFI. |
| 80 | +* checked, saturated, and overflowing operations for various numeric types. |
| 81 | + These aren’t counted in that ‘40’ number above, because there are a _lot_ of |
| 82 | + them, but they all do the same thing. |
| 83 | + |
| 84 | +See the [detailed release notes][notes] for more. |
| 85 | + |
| 86 | +#### Cargo features |
| 87 | + |
| 88 | +There were a few small updates to Cargo: |
| 89 | + |
| 90 | +* An [improvement to build scripts] that allows them to precisely inform Cargo |
| 91 | + about dependences to ensure that they’re only rerun when those files change. |
| 92 | + This should help development quite a bit in repositories with build scripts. |
| 93 | +* A [modification to the `cargo rustc` subcommand], which allows specifying |
| 94 | + profiles to pull in dev-dependencies during testing and such. |
| 95 | + |
| 96 | + |
| 97 | +[improvment to build scripts]: https://github.com/rust-lang/cargo/pull/2279 |
| 98 | +[modification to the `cargo rustc` subcommand]: https://github.com/rust-lang/cargo/pull/2224 |
| 99 | + |
| 100 | +### Contributors to 1.7 |
| 101 | + |
| 102 | +We had 144 individuals contribute to 1.7. Thank you so much! |
| 103 | + |
| 104 | +* Aaron Turon |
| 105 | +* Adam Perry |
| 106 | +* Adrian Heine |
| 107 | +* Aidan Hobson Sayers |
| 108 | +* Aleksey Kladov |
| 109 | +* Alexander Lopatin |
| 110 | +* Alex Burka |
| 111 | +* Alex Crichton |
| 112 | +* Ali Clark |
| 113 | +* Amanieu d’Antras |
| 114 | +* Andrea Bedini |
| 115 | +* Andrea Canciani |
| 116 | +* Andre Bogus |
| 117 | +* Andrew Barchuk |
| 118 | +* Andrew Paseltiner |
| 119 | +* angelsl |
| 120 | +* Anton Blanchard |
| 121 | +* arcnmx |
| 122 | +* Ariel Ben-Yehuda |
| 123 | +* arthurprs |
| 124 | +* ashleysommer |
| 125 | +* Barosl Lee |
| 126 | +* Benjamin Herr |
| 127 | +* Björn Steinbrink |
| 128 | +* bors |
| 129 | +* Brandon W Maister |
| 130 | +* Brian Anderson |
| 131 | +* Brian Campbell |
| 132 | +* Carlos E. Garcia |
| 133 | +* Chad Shaffer |
| 134 | +* Corey Farwell |
| 135 | +* Daan Sprenkels |
| 136 | +* Daniel Campbell |
| 137 | +* Daniel Robertson |
| 138 | +* Dave Hodder |
| 139 | +* Dave Huseby |
| 140 | +* dileepb |
| 141 | +* Dirk Gadsden |
| 142 | +* Eduard Burtescu |
| 143 | +* Erick Tryzelaar |
| 144 | +* est31 |
| 145 | +* Evan |
| 146 | +* Fabrice Desré |
| 147 | +* fbergr |
| 148 | +* Felix Gruber |
| 149 | +* Felix S. Klock II |
| 150 | +* Florian Hahn |
| 151 | +* Geoff Catlin |
| 152 | +* Geoffrey Thomas |
| 153 | +* Georg Brandl |
| 154 | +* ggomez |
| 155 | +* Gleb Kozyrev |
| 156 | +* Gökhan Karabulut |
| 157 | +* Greg Chapple |
| 158 | +* Guillaume Bonnet |
| 159 | +* Guillaume Gomez |
| 160 | +* Ivan Kozik |
| 161 | +* Jack O’Connor |
| 162 | +* Jeffrey Seyfried |
| 163 | +* Johan Lorenzo |
| 164 | +* Johannes Oertel |
| 165 | +* John Hodge |
| 166 | +* John Kåre Alsaker |
| 167 | +* Jonas Schievink |
| 168 | +* Jonathan Reem |
| 169 | +* Jonathan S |
| 170 | +* Jorge Aparicio |
| 171 | +* Josh Stone |
| 172 | +* Kamal Marhubi |
| 173 | +* Katze |
| 174 | +* Keith Yeung |
| 175 | +* Kenneth Koski |
| 176 | +* Kevin Stock |
| 177 | +* Luke Jones |
| 178 | +* Manish Goregaokar |
| 179 | +* Marc Bowes |
| 180 | +* Marvin Löbel |
| 181 | +* Masood Malekghassemi |
| 182 | +* Matt Brubeck |
| 183 | +* Mátyás Mustoha |
| 184 | +* Michael Huynh |
| 185 | +* Michael Neumann |
| 186 | +* Michael Woerister |
| 187 | +* mitaa |
| 188 | +* mopp |
| 189 | +* Nathan Kleyn |
| 190 | +* Nicholas Mazzuca |
| 191 | +* Nick Cameron |
| 192 | +* Nikita Baksalyar |
| 193 | +* Niko Matsakis |
| 194 | +* NODA, Kai |
| 195 | +* nxnfufunezn |
| 196 | +* Olaf Buddenhagen |
| 197 | +* Oliver ‘ker’ Schneider |
| 198 | +* Oliver Middleton |
| 199 | +* Oliver Schneider |
| 200 | +* Pascal Hertleif |
| 201 | +* Paul Dicker |
| 202 | +* Paul Smith |
| 203 | +* Peter Atashian |
| 204 | +* Peter Kolloch |
| 205 | +* petevine |
| 206 | +* Pierre Krieger |
| 207 | +* Piotr Czarnecki |
| 208 | +* Prayag Verma |
| 209 | +* qpid |
| 210 | +* Ravi Shankar |
| 211 | +* Reeze Xia |
| 212 | +* Richard Bradfield |
| 213 | +* Robin Kruppe |
| 214 | +* rphmeier |
| 215 | +* Ruud van Asseldonk |
| 216 | +* Ryan Thomas |
| 217 | +* Sandeep Datta |
| 218 | +* Scott Olson |
| 219 | +* Scott Whittaker |
| 220 | +* Sean Leffler |
| 221 | +* Sean McArthur |
| 222 | +* Sebastian Hahn |
| 223 | +* Sebastian Wicki |
| 224 | +* Sébastien Marie |
| 225 | +* Seo Sanghyeon |
| 226 | +* Sergey Veselkov |
| 227 | +* Simonas Kazlauskas |
| 228 | +* Simon Sapin |
| 229 | +* Stepan Koltsov |
| 230 | +* Stephan Hügel |
| 231 | +* Steve Klabnik |
| 232 | +* Steven Allen |
| 233 | +* Steven Fackler |
| 234 | +* Tamir Duberstein |
| 235 | +* tgor |
| 236 | +* Thomas Wickham |
| 237 | +* Thomas Winwood |
| 238 | +* Tobias Bucher |
| 239 | +* Tomasz Miąsko |
| 240 | +* tormol |
| 241 | +* Tshepang Lekhonkhobe |
| 242 | +* Ulrik Sverdrup |
| 243 | +* Vadim Petrochenkov |
| 244 | +* Vincent Esche |
| 245 | +* Vlad Ureche |
| 246 | +* Wangshan Lu |
| 247 | +* Wesley Wiser |
0 commit comments