📜 ⬆️ ⬇️

Rust 1.8 Preview

We are pleased to introduce the new version of Rust - 1.8. Rust is a system programming language aimed at safe work with memory, speed and parallel code execution.

As usual, you can install Rust 1.8 from the corresponding page of the official site, as well as see a detailed list of changes in this version on GitHub. This release included about 1400 patches.


What is included in the stable version 1.8


The release includes two new features, and we also have good news for Windows users! Also, work continues on replacing make in our build system with Cargo.
')
First, various compound assignment operators, such as += and -= , can now be overloaded through the corresponding traits. This change was the result of RFC 953 and is as follows:


 use std::ops::AddAssign; #[derive(Debug)] struct Count { value: i32, } impl AddAssign for Count { fn add_assign(&mut self, other: Count) { self.value += other.value; } } fn main() { let mut c1 = Count { value: 1 }; let c2 = Count { value: 5 }; c1 += c2; println!("{:?}", c1); } 

This code will print Count { value: 6 } . Like other treit operators, associated types allow different types to be used on both sides of an operator. See the RFC for details.

The second option is much simpler and is the result of RFC 218 . Prior to version 1.8 in Rust, structures with no data could not use curly braces:


 struct Foo; //  struct Bar { } //  

From now on, the second option does not lead to an error. Initially, it was forbidden for consistency with other "empty declarations" and the uniqueness of parsing. However, in the following for 1.0 versions of Rust, the problem of ambiguity was solved, and the authors of macros faced additional difficulties due to the need to support both cases. In addition, with active development, it is periodically necessary to move from empty structures to non-empty and vice versa, which leads to additional work and complicates the perception of changes in patches.

Stack promotion was implemented for 32-bit MSVC builds. This translates the i686-pc-windows-msvc into the category of mainstream platforms.

We used make to build Rust for a long time, while we have an amazing tool for building programs on Rust - Cargo. In version 1.8, the initial support for the new build system appeared, which is written in Rust and uses Cargo as the basis. This system is not yet used by default, and there is still a lot of work to be done. We'll let you know when it comes to an end, but for now, if you are interested in the details, have a look at GitHub.


Library stabilization


In version 1.8, about 20 functions and methods were stabilized, which can be divided into three main groups: support for UTF-16, various functions for working with time, and additional traits for the operator overload mentioned above.


Cargo features


Several improvements have been made:



For more information, see the complete list of changes .


Developers version 1.8


In the release of version 1.8, 126 people participated. Thank you very much!


Developer List 1.8
  • Aaron turon
  • Abhishek chanda
  • Adolfo ochagavía
  • Aidan hobson sayers
  • Alan somers
  • Alejandro wainzinger
  • Aleksey Kladov
  • Alex Burka
  • Alex Crichton
  • Amanieu d'anthras
  • Andrea Canciani
  • Andreas Linz
  • Andrew Cantino
  • Andrew horton
  • Andrew Paseltiner
  • Andrey Cherkashin
  • Angus lees
  • arcnmx
  • Ariel Ben-Yehuda
  • ashleysommer
  • Benjamin herr
  • Valery Lashmanov
  • Björn steinbrink
  • bors
  • Brian anderson
  • Brian bowman
  • Christian wesselhoeft
  • Christopher Serr
  • Corey farwell
  • Craig M. Brandenburg
  • Cyryl Płotnicki-Chudyk
  • Daniel J Rollins
  • Dave huseby
  • David Ao Lozano
  • David Henningsson
  • Devon hollowood
  • Dirk gadsden
  • Doug goldstein
  • Eduard burtescu
  • Eduard-Mihai Burtescu
  • Eli friedman
  • Emanuel czirai
  • Erick tryzelaar
  • Evan
  • Felix S. Klock II
  • Florian berger
  • Geoff catlin
  • ggomez
  • gohyda
  • Gökhan Karabulut
  • Guillaume gomez
  • ituxbag
  • James miller
  • Jeffrey seyfried
  • John talling
  • Jonas schievink
  • Jonathan s
  • Jorge aparicio
  • Joshua holmer
  • JP Sugarbroad
  • Kai noda
  • Kamal Marhubi
  • Katze
  • Kevin brothaler
  • Kevin butler
  • Manish goregaokar
  • Markus westerlind
  • Marvin lobel
  • Masood Malekghassemi
  • Matt brubeck
  • Michael Huynh
  • Michael Neumann
  • Michael Woerister
  • mitaa
  • Ms2ger
  • Nathan Kleyn
  • nicholasf
  • Nick cameron
  • Niko Matsakis
  • Noah
  • NODA, Kai
  • Novotnik, Petr
  • Oliver middleton
  • Oliver schneider
  • petevine
  • Philipp Oppermann
  • pierzchalski
  • Piotr czarnecki
  • pravic
  • Pyfisch
  • Richo healey
  • Ruud van Asseldonk
  • Scott olson
  • Sean McArthur
  • Sebastian wicki
  • Sebastien marie
  • Seo sanghyeon
  • Simonas kazlauskas
  • Simon sapin
  • srinivasreddy
  • Steve klabnik
  • Steven allen
  • Steven fackler
  • Stu black
  • Tang chenglong
  • Ted horst
  • Ticki
  • tiehuis
  • Tim Montague
  • Tim neumann
  • Timon van overveldt
  • Tobias bucher
  • Tobias müller
  • Todd lucas
  • Tom Tromey
  • Tshepang Lekhonkhobe
  • ubsan
  • Ulrik sverdrup
  • Vadim Petrochenkov
  • vagrant
  • Valentin lorentz
  • Varun vats
  • vegai
  • vlastachu
  • Wangshan Lu
  • York xiang

Source: https://habr.com/ru/post/281152/


All Articles