

























The Rust team is happy to announce the latest version of Rust, 1.10. Rust is a systems programming language focused on safety, speed, and concurrency.
As always, you can install Rust 1.10 from the appropriate page on our website, and check out the detailed release notes for 1.10 on GitHub. 1276 patches were landed in this release.
Rust 1.10 contains one of the most-requested features in Rust: through the -C panic=abort flag or a setting in your Cargo.toml, when a panic!
happens, it will abort rather than unwind. Why would you want to do this?
Remember that panics are for unexpected problems, and for many applications,
aborting is a reasonable choice. With an abort, less code gets generated,
meaning that binary sizes are a bit smaller, and compilation time is
ever-so-slightly faster. Some very rough numbers are 10% smaller binaries, and
10% faster compilation time. This feature was defined in RFC 1513.
The second big feature in 1.10 is a new crate type: cdylib. The existing
dylib dynamic library format will now be used solely for writing a dynamic
library to be used within a Rust project, while cdylibs will be used when
compiling Rust code as a dynamic library to be embedded in another language.
With the 1.10 release, cdylibs are supported by the compiler, but not yet in
Cargo. This format was defined in RFC 1510.
In addition, a number of performance improvements landed in the
compiler,
and so did a number of usability
improvements
across the documentation, rustdoc itself, and various error messages.
Finally, there's a large change to the way that we develop Rust that won't impact Rust users directly, but will help those distributing Rust significantly. Rust is implemented in Rust, which means that to build a copy of Rust, you need a copy of Rust. This is commonly referred to as 'bootstrapping'. Historically, we would do this by "snapshotting" a specific version of the compiler, and always bootstrapping from that; the snapshot would periodically be updated, as needed. Furthermore, since the Rust compiler uses unstable Rust features, in order to build a copy of the stable compiler, you would need a specific nightly version of the Rust compiler. This has served us well for years, but we've outgrown it now. The main drawback to this approach is that it requires downloading a snapshot binary, which is not ideal for an important constituency: Linux distributions. In particular, distros generally want to be able to build the latest version of Rust using only previously-packaged versions that they have produced, rather than via untrusted binaries. As such, we have modified our build system so that Rust 1.10 builds with Rust 1.9. In the future, this pattern will continue; Rust 1.11 will be built with Rust 1.10. Furthermore, you can use the stable compiler to build the compiler. This simplifies everything around bootstrapping, and helps distribution maintainers significantly, as they no longer need two packages. You can find more details about this change in its pull request.
See the detailed release notes for more.
Roughly 70 APIs were made stable in this release. They break down into these rough groups:
std::os::windows::fs::OpenOptionsExt, for Windows-specific file operations.std::panic::{set,take}_hook.CStr::from_bytes_with_nul, to create a CStr from a byte slice (and an unchecked variant).std::fs::Metadata.compare_exchange for various atomic types.std::os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}.In addition, Default was implemented for &CStr, CString,
UnsafeCell, fmt::Error, Condvar, Mutex, and RwLock.
Finally, on Linux, if HashMaps can't be initialized with getrandom they will
fall back to /dev/urandom temporarily to avoid blocking during early boot.
See the detailed release notes for more.
Cargo has received a number of small improvements in this release.
profile.*.panic option can control how you'd like
panics implemented for your project.--force flag has been added to cargo install.cargo test now takes a --doc flag for running only documentation tests.cargo --explain was added, mirroring rustc --explain.See the detailed release notes for more.
We had 139 individuals contribute to 1.10. Thank you so much!
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。