BT

Rust 1.10 Improves Bootstrapping, Panic Handling, and More

| by Sergio De Simone Follow 21 Followers on Jul 11, 2016. Estimated reading time: 1 minute |

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 Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT