zero.rs: write Rust without a runtime

Late last week, pcwalton released Zero.rs, a way to write Rust code without a runtime.

What does that mean? Well, normally, a runtime defines all of the basic features a language supports. For example, the garbage collector. You need this to be compiled in with your program for the program to work properly.

What zero.rs does is provides small stubs for everything that is absolutely necessary for a given Rust program. The only thing that zero.rs depends on is 5 C functions, which are usually provided by libc.

What does that mean? Well:

Garbage collection, tasks, and failure will not work. All the other language features, including unique pointers, references, and closures do work, so programs such as sprocketnes that do not use garbage collection should be fine.

The Rust standard library cannot be used in this mode, but splitting out the Rust standard library into a portion that can be used in freestanding mode would be an interesting and valuable project (IMO).

Why is this useful? Well, you could use Rust to write the Rust runtime. Or you could write a Linux kernel module, since it doesn't depend on the rest of Rust. Or you could write an operating system in Rust. Or write the Rust garbage collector in Rust. Reducing dependencies means that it's much easier to use Rust in a large number of places.

News Films

Our little film studio focuses on telling developer-centric stories that need to be seen.

Beyond Code: Season 3 / GopherCon 2015

 
0:00 / 0:00