BT

InfoQ Homepage News Rust 1.6 Brings Stable Support for OS and Embedded Development

Rust 1.6 Brings Stable Support for OS and Embedded Development

Bookmarks

In keeping with their release model, the Rust development team has announced the first Rust release of 2016, 1.6. The biggest new feature that Rust 1.6 brings is libcore stabilization, which aims to make it possible to use stable Rust for OS and embedded software development.

libcore provides a low-level, platform agnostic foundations on top of which Rust standard library, libstd, builds higher-level functionality such as memory allocation, I/O, and concurrency. As such, libcore is the lowest-level layer that OS and embedded software developers often prefer basing their application on, and bringing stability to libcore means thus providing stable foundations for such kind of lower-level software.

As Rust core team member Steve Klabnik told to InfoQ, the importance of this cannot be understated:

It’s the first big step towards making OS/embedded development work on stable Rust. So it’s important, but it’s still just the first step. I do think that demonstrating that Rust is a viable option at the lowest levels of software is important for its future.

An important caveat, though, is that libcore currently supports only development of libraries, whereas applications are not fully supported yet. Klabnik explained to InfoQ, the reason why libcore does not fully support applications lies with a few undefined “lang items” that it needs. In Rust, lang items can be thought of as linker symbols that can be used as “hooks” into the language itself. This make it possible, e.g., to implement part of Rust functionality in libraries and not in the language itself. According to Klabnik, this is no big deal for developers who want to build a library that does not use libstd (no_std). Indeed, he says:

We will probably not be adding these two [lang items] to libcore itself. They’re specifically for users to implement in the way that’s appropriate for them. If you are attempting to build an executable with no_std, then you must define the two lang items yourself.

Klabnik also provided the link to a source file of his where he shows how those missing symbols can be defined:

#[lang = "eh_personality"]
extern "C" fn eh_personality() {
}
#[lang = "panic_fmt"]
fn panic_fmt() -> ! {
    loop {}
}

#[lang = "begin_unwind"]
pub extern "C" fn begin_unwind() {
}

Besides stable libcore, Rust 1.6 adds a host of small refinements to library functions and language features, most notably the drain family of functions, used to remove elements out of a collection while also retaining their backing memory, and new From conversions. A full list of all changes can be read in the release notes.

Rate this Article

Adoption
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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.