Rust: A Friendly Introduction

A session at Open Source Bridge 2013

Wednesday 19th June, 2013

10:00am to 11:45am (PST)

When writing systems-level applications like operating systems, device drivers, and Web browser engines, many things can go wrong. Null pointers, buffer overflows, and memory leaks all occur in C and C++-based applications in the wild, and can all cause serious security vulnerabilities. C and C++ compilers and tools are at best only partially able to detect these problems during development. While memory-safe languages such as Haskell and Scala solve these problems, historically, systems programmers have not found these languages acceptable for meeting their performance goals. Rust, a new open-source language being stewarded by Mozilla, aims to make memory safety bugs a thing of the past without sacrificing performance. Rust supports large-scale programming and its needs for reliability, efficient use of space and time, and concurrency.

In this tutorial talk, I will show you how to write fast code in Rust with the help of a compiler that detects many potential bugs at compile time. I will start by showing you how to write simple prototypes in a subset of Rust that uses garbage collection. Then, I will refine these examples to use Rust's "borrowed pointers". Using borrowed pointers eliminates the overhead of garbage collection because the compiler can determine these pointers' lifetimes at compile time. I will show you how to manage memory in Rust in ways that are just as efficient as they would be in a C++ program but enjoy stronger compile-time correctness checking than C++ compilers provide. As I'll explain, this style of coding requires more thought during development because you have to be explicit about the relationships between data structures in memory, but it pays off in the long term by eliminating dangling pointers and memory leaks, without incurring unwanted memory management overhead.

All the examples I'll show will be based on real applications, potentially drawn from an audio decoder, an NES game emulator, and a prototype Web browser engine (Servo - https://github.com/mozilla/servo - under development at Mozilla). All examples will be adapted from open-source programs that are freely available on Github. I'll assume that audience members are comfortable programming in at least one language and have at least a passing familiarity with either C or C++.

About the speaker

This person is speaking at this event.
Tim Chevalier

Fourth-wave feminist, hacker, queer, cyclist. bio from Twitter

Sign in to add slides, notes or videos to this session

Tell your friends!


Time 10:00am11:45am PST

Date Wed 19th June 2013

Short URL


Official session page


View the schedule



See something wrong?

Report an issue with this session