We are pleased to introduce the new version of Rust 1.10. Rust is a system programming language aimed at the safe work with memory, speed and parallel code execution.
As usual, you can install Rust 1.10 from the corresponding page of the official site, and also get acquainted with the detailed list of changes in this version on GitHub. This release included 1276 patches.
In Rust 1.10, one of the most desirable features of the community became available: interruption of work (abort) during panic instead of unwinding the stack. This behavior is controlled by the -C panic=abort
flag or setting in Cargo.toml
. Why do you need it? As you remember, panic means an unforeseen problem , and for many applications, abort is a smart choice. When using panic=abort
, less code is generated, which means smaller executable files and a slightly smaller compilation time. A very rough estimate indicates a decrease of 10% in both file size and compile time. This feature was defined in RFC 1513 .
The second big feature in 1.10 is a new type of container - cdylib
. The existing dylib
dynamic library dylib
now only used for dynamic libraries used in Rust projects, and cdylib
will be used when compiling Rust code for embedding into other languages. In release 1.10, cdylib
supported by the compiler, but not yet supported by Cargo. This format was defined in RFC 1510 .
Also, in some cases, the compiler performance has been improved, the documentation and rustdoc
itself rustdoc
become more convenient , and error messages have become more readable.
Finally, there has been a big change in the development of Rust. It does not affect users directly, but it will greatly help those who distribute Rust. The Rust compiler is written in Rust, which means using Rust to build Rust. This process is called "bootstrapping" ( English "bootstrapping"). Historically, we did this using snapshots of a particular version of the compiler, of which always bootstrapped; at the same time, the snapshot is periodically updated, if necessary. Moreover, since The Rust compiler uses the unstable capabilities of Rust. To build the compiler, a specific version of nightly was needed. This has worked well for years, but we have outgrown such a process. Its main drawback is that it requires loading a snapshot in binary form, which is not suitable for Linux distributions. In particular, the distribution maintainers would like to build the latest versions of Rust, using only the versions available in previous versions of packages, and not untrusted binaries. In fact, we changed our build system so that Rust 1.10 is built with the Rust 1.9 compiler. In the future, this method will be used later - Rust 1.11 will be built using Rust 1.10. Moreover, now the compiler can be built with a stable compiler. This simplifies the entire bootstrap process, and greatly helps distribution distributions keepers, because they no longer need two separate packages. Read more in the comments to the pull request .
More information about changes in the language as a whole can be found in the release notes.
Approximately 70 interfaces were stabilized:
std::os::windows::fs::OpenOptionsExt
.std::panic::{set,take}_hook
.CStr::from_bytes_with_nul
to create a CStr
from a byte slice ( and an unchecked version ).std::fs::Metadata
.compare_exchange
for different atomic types .std::os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}
.In addition, &CStr
, CString
, UnsafeCell
, fmt::Error
, Condvar
, Mutex
, and RwLock
now implemented as Default
.
Finally, on Linux, if the HashMap cannot be initialized using getrandom
, it will temporarily roll back to use /dev/urandom
so as not to block early during the boot process.
See the release notes for details.
In this issue, Cargo received several small improvements.
profile.*.panic
setting profile.*.panic
Panic controls how panic should be performed.cargo install
has a flag --force
.cargo test
now accepts the --doc
flag , with which only tests in the documentation are performed.cargo --explain
, which reflects the rustc --explain
flag.See the release notes for details.
In the release of version 1.10, 139 people participated. Thank you very much!
Source: https://habr.com/ru/post/305486/