Rust 1.9 improves speed, error handling

27.05.2016
Rustaceans, rejoice.

Only a little more than a month after Rust 1.8 debuted with a new build system, here comes version 1.9. It's outfitted with compilation speed overhauls, better cross-compilation tools, and enhanced error handling in the language itself.

This last addition provides the most direct boon for Rust developers. As explained in the blog post introducing version 1.9, it's a set of stabilizations for, and additions to, the std::panic module. If a particular thread in a Rust program panics -- that is, runs up against an unexpected error -- a new API, catch_unwind, can intercept the panic process from another thread, allow it to be continued if needed (via resume_unwind), and thus allow the app as a whole to better deal with the resulting error.

Another major new addition is rustup, a toolchain manager for Rust that allows the developer to keep up to date with, and switch between, the Rust toolchain for different target platforms. Rust has traditionally allowed cross-compilation thanks to its LLVM compiler back end, but manually managing the toolchain around it hasn't been as easy. Rustup closes that gap, although it doesn't yet set up the C toolchain needed by some Rust components (e.g., to compile anything with dependencies in C).

"That functionality is not shipping today, but it's something we hope to incorporate over the next few months," write Rust's maintainers.

Rust 1.9 includes some subtle but significant fixes that pave the way to speed up both program execution and compilation times. A new optimization, specialization, "allows generic code to automatically be specialized based on more specific type information" that can be leveraged for better performance in the future. Another fix makes for much speedier testing for equivalence, making some kinds of code compile a great deal faster.

Also new, and useful: APIs in libraries created by developers can now be tagged with deprecation warnings. Given how fast Rust's ecosystem has been moving, including its culture of third-party libraries, this is more important than it might look, as it provides library developers with a graceful way to warn users when something is being eliminated -- for instance, if it depends on a Rust feature that's also being reworked or phased out.

The Rust development team tipped its hand last year about its goals for the language in 2016. Many of those goals are being swiftly met, like nailing down the standard library and enabling push-button cross-compilation. Still to be unveiled, though, is incremental compilation, allowing for faster project rebuilds -- but the MIR additions to Rust back in April are a prelude to that.

(www.infoworld.com)

Serdar Yegulalp

Zur Startseite