BT

Rust 1.12 Brings Mid-Level IR

| by James Chesters Follow 2 Followers on Oct 05, 2016. Estimated reading time: 2 minutes |

The Rust core team has released the stable version of 1.12, calling it one of the most significant Rust releases since 1.0. The release brings the long-awaited Mid-Level IR (MIR), paving the way for future compiler optimisations.

In the blog post Introducing MIR, Mozilla's Niko Matsakis said:

MIR comes between the existing HIR (“high-level IR”, roughly an abstract syntax tree) and LLVM (the “low-level” IR.) Previously, the “translation” phase in the compiler would convert from full-blown Rust into machine-code-like LLVM in one rather large step. But now, it will do its work in two phases, with a vastly simplified version of Rust – MIR – standing in the middle.

Rust contributor Steve Klabnik says that the simplified translation pass creates opportunities to perform new optimisations directly on the MIR.

While the Rust team claim that MIR doesn't bring anything "user-visible" Matsakis details a faster compilation time, with incremental compiling, along with a faster execution time, and more precise type checking.

The latest stable release brings some significant updates that are user visible, including a new format for rustc error messages, as show below:

The team explains:

[the new error format] helps to surface a lot of the internal knowledge about why an error is occurring to you, the developer. It does this by putting your code front and center, highlighting the parts relevant to the error with annotations describing what went wrong.

In the new error format we represent the error by showing the points in the code that matter the most.

Initially, this error design was built to aid in understanding borrow-checking errors, but we found the format can be broadly applied to a wide variety of errors. If you would like to learn more about the design, check out the previous blog post on the subject.

Mozilla engineer Jonathan Turner described the significance of this change in the blog post Shape of Errors to Come, saying that by using the code the developer wrote as the context, Rust gives an easy way to know at a glance where the issue is occurring.

Also new in the 1.12 release is the workspaces feature for Cargo, allowing a group of Rust packages to share the same Cargo.lock file making it easier for developers to be able to keep shared dependencies on a single version.

Detailed release notes for Rust 1.12 are available on GitHub, and the release can be downloaded from here.

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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT