|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Announcing Rust 1.8" |
| 4 | +author: The Rust Core Team |
| 5 | +--- |
| 6 | + |
| 7 | +The Rust team is happy to announce the latest version of Rust, 1.8. Rust is a |
| 8 | +systems programming language focused on safety, speed, and concurrency. |
| 9 | + |
| 10 | +As always, you can [install Rust 1.8][install] from the appropriate page on our |
| 11 | +website, and check out the [detailed release notes for 1.8][notes] on GitHub. |
| 12 | +About 1400 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-180-2016-04-14 |
| 16 | + |
| 17 | +### What's in 1.8 stable |
| 18 | + |
| 19 | +There are two new features in Rust 1.8, as well as good news for Windows users! |
| 20 | +Additionally, work is underway to replace our `make`-based build system with |
| 21 | +one based on Cargo. |
| 22 | + |
| 23 | +The first feature is that the various “operator equals” operators, such as `+=` |
| 24 | +and `-=`, are now overloadable via various traits. This change was accepted in |
| 25 | +[RFC 953], and looks like this: |
| 26 | + |
| 27 | +```rust |
| 28 | +use std::ops:: AddAssign; |
| 29 | + |
| 30 | +#[derive(Debug)] |
| 31 | +struct Count { |
| 32 | + value: i32, |
| 33 | +} |
| 34 | + |
| 35 | +impl AddAssign for Count { |
| 36 | + fn add_assign(&mut self, other: Count) { |
| 37 | + self.value += other.value; |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +fn main() { |
| 42 | + let mut c1 = Count { value: 1 }; |
| 43 | + let c2 = Count { value: 5 }; |
| 44 | + |
| 45 | + c1 += c2; |
| 46 | + |
| 47 | + println!("{:?}", c1); |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +[RFC 953]: https://github.com/rust-lang/rfcs/blob/master/text/0953-op-assign.md |
| 52 | + |
| 53 | +This will print out `Count { value: 6 }`. Like the other operator traits, an |
| 54 | +associated type allows you to use different types on each side of the operator, |
| 55 | +as well. See the RFC for more details. |
| 56 | + |
| 57 | +The second feature is very small, and comes from [RFC 218]. Before Rust 1.8, a |
| 58 | +`struct` with no fields did not have curly braces: |
| 59 | + |
| 60 | +```rust |
| 61 | +struct Foo; // works |
| 62 | +struct Bar { } // error |
| 63 | +``` |
| 64 | + |
| 65 | +[RFC 218]: https://github.com/rust-lang/rfcs/blob/master/text/0218-empty-struct-with-braces.md |
| 66 | + |
| 67 | +The second form is no longer an error. This was |
| 68 | +originally disallowed for consistency with other empty declarations, as well as |
| 69 | +a parsing ambiguity. However, that ambiguity is non-existent in post-1.0 Rust, |
| 70 | +and macro authors saw additional complexity due to needing a special-case. Also, |
| 71 | +users who do active development would sometimes switch between empty and |
| 72 | +non-empty versions of a struct, and the extra work and diffs involved was less |
| 73 | +than ideal. |
| 74 | + |
| 75 | +On the Windows front, 32-bit MSVC builds [now implement unwinding]. This moves |
| 76 | +`i686-pc-windows-msvc` to a Tier 1 platform. |
| 77 | + |
| 78 | +[now implement unwinding]: https://github.com/rust-lang/rust/pull/30448 |
| 79 | + |
| 80 | +Finally, we have used `make` to build Rust for a very long time. However, |
| 81 | +we already have a wonderful tool for building Rust programs: Cargo. In Rust |
| 82 | +1.8, [initial support landed] for a new build system that’s written in Rust, |
| 83 | +and based on Cargo. It is not yet the default, and there is much more work to |
| 84 | +do. We will talk about this in release notes more once it’s completely done, |
| 85 | +for now, please read the GitHub issue for more details. |
| 86 | + |
| 87 | +[initial support landed]: https://github.com/rust-lang/rust/pull/31123 |
| 88 | + |
| 89 | +#### Library stabilizations |
| 90 | + |
| 91 | +About 20 library functions and methods are now stable in 1.8. There are three |
| 92 | +major groups of changes: UTF-16 related string methods, various APIs related to |
| 93 | +time, and the various traits needed for operator overloading mentioned in the |
| 94 | +language section. |
| 95 | + |
| 96 | +Other notable improvements include: |
| 97 | + |
| 98 | +* `<[T]>::clone_from_slice()`, an efficient way to copy the data from one slice |
| 99 | + and put it into another slice. |
| 100 | +* Various convenience methods on `Ipv4Addr` and `Ipv6Addr`, such as `is_loopback()`, |
| 101 | + which returns `true` or `false` if the address is a loopback address according to |
| 102 | + RFC 6890. |
| 103 | +* Various improvements to `CString`, used for FFI. |
| 104 | +* checked, saturated, and overflowing operations for various numeric types. |
| 105 | + These aren’t counted in that ‘40’ number above, because there are a _lot_ of |
| 106 | + them, but they all do the same thing. |
| 107 | + |
| 108 | +See the [detailed release notes][notes] for more. |
| 109 | + |
| 110 | +#### Cargo features |
| 111 | + |
| 112 | +There were a few updates to Cargo: |
| 113 | + |
| 114 | +* [`cargo init`](https://github.com/rust-lang/cargo/pull/2081) can be used to |
| 115 | + start a Cargo project in your current working directory, rather than making a |
| 116 | + new subdirectory like `cargo new`. |
| 117 | +* [`cargo metadata`](https://github.com/rust-lang/cargo/pull/2196) is another |
| 118 | + new subcommand for fetching metadata about a project. |
| 119 | +* `.cargo/config` now has [keys for `-v` and |
| 120 | + `--color`](https://github.com/rust-lang/cargo/pull/2397) |
| 121 | +* Cargo’s ability to have target-specific dependencies [was |
| 122 | + enhanced](https://github.com/rust-lang/cargo/pull/2328). |
| 123 | + |
| 124 | + |
| 125 | +See the [detailed release notes][notes] for more. |
| 126 | + |
| 127 | +### Contributors to 1.8 |
| 128 | + |
| 129 | +We had 126 individuals contribute to 1.8. Thank you so much! |
| 130 | + |
| 131 | +* Aaron Turon |
| 132 | +* Abhishek Chanda |
| 133 | +* Adolfo Ochagavía |
| 134 | +* Aidan Hobson Sayers |
| 135 | +* Alan Somers |
| 136 | +* Alejandro Wainzinger |
| 137 | +* Aleksey Kladov |
| 138 | +* Alex Burka |
| 139 | +* Alex Crichton |
| 140 | +* Amanieu d'Antras |
| 141 | +* Andrea Canciani |
| 142 | +* Andreas Linz |
| 143 | +* Andrew Cantino |
| 144 | +* Andrew Horton |
| 145 | +* Andrew Paseltiner |
| 146 | +* Andrey Cherkashin |
| 147 | +* Angus Lees |
| 148 | +* arcnmx |
| 149 | +* Ariel Ben-Yehuda |
| 150 | +* ashleysommer |
| 151 | +* Benjamin Herr |
| 152 | +* Валерий Лашманов |
| 153 | +* Björn Steinbrink |
| 154 | +* bors |
| 155 | +* Brian Anderson |
| 156 | +* Brian Bowman |
| 157 | +* Christian Wesselhoeft |
| 158 | +* Christopher Serr |
| 159 | +* Corey Farwell |
| 160 | +* Craig M. Brandenburg |
| 161 | +* Cyryl Płotnicki-Chudyk |
| 162 | +* Daniel J Rollins |
| 163 | +* Dave Huseby |
| 164 | +* David AO Lozano |
| 165 | +* David Henningsson |
| 166 | +* Devon Hollowood |
| 167 | +* Dirk Gadsden |
| 168 | +* Doug Goldstein |
| 169 | +* Eduard Burtescu |
| 170 | +* Eduard-Mihai Burtescu |
| 171 | +* Eli Friedman |
| 172 | +* Emanuel Czirai |
| 173 | +* Erick Tryzelaar |
| 174 | +* Evan |
| 175 | +* Felix S. Klock II |
| 176 | +* Florian Berger |
| 177 | +* Geoff Catlin |
| 178 | +* ggomez |
| 179 | +* gohyda |
| 180 | +* Gökhan Karabulut |
| 181 | +* Guillaume Gomez |
| 182 | +* ituxbag |
| 183 | +* James Miller |
| 184 | +* Jeffrey Seyfried |
| 185 | +* John Talling |
| 186 | +* Jonas Schievink |
| 187 | +* Jonathan S |
| 188 | +* Jorge Aparicio |
| 189 | +* Joshua Holmer |
| 190 | +* JP Sugarbroad |
| 191 | +* Kai Noda |
| 192 | +* Kamal Marhubi |
| 193 | +* Katze |
| 194 | +* Kevin Brothaler |
| 195 | +* Kevin Butler |
| 196 | +* Manish Goregaokar |
| 197 | +* Markus Westerlind |
| 198 | +* Marvin Löbel |
| 199 | +* Masood Malekghassemi |
| 200 | +* Matt Brubeck |
| 201 | +* Michael Huynh |
| 202 | +* Michael Neumann |
| 203 | +* Michael Woerister |
| 204 | +* mitaa |
| 205 | +* Ms2ger |
| 206 | +* Nathan Kleyn |
| 207 | +* nicholasf |
| 208 | +* Nick Cameron |
| 209 | +* Niko Matsakis |
| 210 | +* Noah |
| 211 | +* NODA, Kai |
| 212 | +* Novotnik, Petr |
| 213 | +* Oliver Middleton |
| 214 | +* Oliver Schneider |
| 215 | +* petevine |
| 216 | +* Philipp Oppermann |
| 217 | +* pierzchalski |
| 218 | +* Piotr Czarnecki |
| 219 | +* pravic |
| 220 | +* Pyfisch |
| 221 | +* Richo Healey |
| 222 | +* Ruud van Asseldonk |
| 223 | +* Scott Olson |
| 224 | +* Sean McArthur |
| 225 | +* Sebastian Wicki |
| 226 | +* Sébastien Marie |
| 227 | +* Seo Sanghyeon |
| 228 | +* Simonas Kazlauskas |
| 229 | +* Simon Sapin |
| 230 | +* srinivasreddy |
| 231 | +* Steve Klabnik |
| 232 | +* Steven Allen |
| 233 | +* Steven Fackler |
| 234 | +* Stu Black |
| 235 | +* Tang Chenglong |
| 236 | +* Ted Horst |
| 237 | +* Ticki |
| 238 | +* tiehuis |
| 239 | +* Tim Montague |
| 240 | +* Tim Neumann |
| 241 | +* Timon Van Overveldt |
| 242 | +* Tobias Bucher |
| 243 | +* Tobias Müller |
| 244 | +* Todd Lucas |
| 245 | +* Tom Tromey |
| 246 | +* Tshepang Lekhonkhobe |
| 247 | +* ubsan |
| 248 | +* Ulrik Sverdrup |
| 249 | +* Vadim Petrochenkov |
| 250 | +* vagrant |
| 251 | +* Valentin Lorentz |
| 252 | +* Varun Vats |
| 253 | +* vegai |
| 254 | +* vlastachu |
| 255 | +* Wangshan Lu |
| 256 | +* York Xiang |
0 commit comments