BT

Rust 1.6 Brings Stable Support for OS and Embedded Development

| by Sergio De Simone Follow 18 Followers on Jan 25, 2016. Estimated reading time: 2 minutes |

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

Some related critique of Rust for OS and Embedded Development by Dzmitry Lahoda

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

1 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