Rust, positioned as a fast programming language for systems and native applications, is getting a new error message format and improved compilation with the newly released version 1.12.
Out Sept. 29, Rust 1.12 is the 12th update to the language since Rust 1.0 arrived in May 2015. "The release of 1.12 might be one of the most significant Rust releases since 1.0," the Rust Core Team said.
Topping the list of user-facing changes in 1.12 is an error message format emitted by rustc. "We've previously talked about this format and this is the first stable release where they are broadly available," said the Rust team. The format helps surface internal knowledge about why an error is occurring. "It does this by putting your code front and center, highlighting the parts relevant to the error with annotations describing what went wrong." Errors are represented by showing the points in code that most matter, the team said, and errors can be shown be shown as JSON with a flag.
The upgrade moves to a compiler back end based on the new Rust MIR (Mid-level Intermediate Representation), intended to produce quicker compilation and execution times, as well as more precise type-checking. "While this feature does not result in anything user-visible today, it paves the way for a number of future compiler optimizations, and for some code bases it already results in improvements to compile times and reductions in code size," the team said. MIR exposes information about a program's control flow, letting the compiler know whether types are moved or not; thus, MIR means less work for the compiler and less bloat at runtime.
Rust 1.12 also features documentation improvements, a warning when tests run more than 60 seconds, and the ability to build the compiler against LLVM 3.9. Types in the standard library features a number of small "quality of life" improvements, and the Cargo package manager adds workspaces for a group of Rust packages to share the same Cargo.lock file. "If you have a project that's split up into multiple packages, this makes it much easier to keep shared dependencies on a single version," according to the team.
Developers can override the source of a Cargo crate. "Using this with tools like cargo-vendor and cargo-local-registry allow vendoring dependencies locally in a robust fashion. Eventually this support will be the foundation of supporting mirrors of crates.io as well."
Developed by Mozilla, Rust has been viewed as a safer alternative to C and C++ for system-level programming, offering security and multicore processor support. It has been gathering adherents, ranking 21st in the PyPL Popularity of Programming Language index, which assesses language popularity based on Google searches, in September and 45th in the September Tiobe Index, which looks at searches in several indexes.
Sign up for CIO Asia eNewsletters.