BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Rust 1.10 Improves Bootstrapping, Panic Handling, and More

Rust 1.10 Improves Bootstrapping, Panic Handling, and More

This item in japanese

Newly released Rust 1.10 introduces a new approach to bootstrapping that aims to be friendlier to open-source distributions. Additionally, it adds a new cargo option for handling panic that improves compiler performance and reduces binary size, a new format for shared libraries, and many performance improvements.

With version 1.10 the approach to bootstrapping Rust, i.e., building the Rust compiler using the Rust compiler itself, has been modified so it does no rely on any unstable Rust features, as was previously the case. The main drawback of using unstable features is the necessity to use a specific nightly version of the Rust compiler, which was not ideal for Linux distributions. Indeed, many Linux distributions prefer building their packages only through previously-packaged versions, rather than via untrusted binaries. As a result of this change, Rust 1.10 can now be built from Rust 1.9. In the future, any new version of Rust will be built with the current stable release, e.g. Rust 1.11 with Rust 1.10.

As mentioned, Rust 1.10 introduces a new build option that allows developers to define Rust’s panic! behavior. By default, panic! will trigger stack unwinding, which has some cost in terms of both compiler performance and binary size. For many applications, though, aborting is a perfectly reasonable way to deal with unexpected problems. To make Rust abort instead of unwinding, developers can now specify the -C panic=abort command line option or add panic=abort to Cargo.toml, which will bring a 10% gain both in binary size and compilation time.

Also new in Rust 1.10 is the cdylib crate type, which is meant to be used for libraries to be embedded in another language. The main differences between cdylib and the existing dylib, which remains the preferred format for libraries to be used within Rust projects, are the following:

  • cdylib are for static linking
  • No metadata is included
  • Only reachable extern functions are visible symbols, similarly to executables
  • Link time optimization is allowed using the -C flag

In addition, Rust 1.10 brings a number of performance improvements, including:

Rust 1.10 includes many more changes that you can read about in the release notes.

Rate this Article

Adoption
Style

BT