The following is the outline of a project I’ve recently completed about the Rust programming language.
Rust is a systems programming language designed for writing safe, concurrent, and fast applications. Armed with a strong community, the development of the language is driven by the idea that not everything in Computer Science must be a trade-off.[2, 13:00] In its language design, Rust chooses to build off of its predecessors and focus on one primary concept that makes it unique: its well defined system of ownership and borrowing of resources. The following research centers around three major topics – a high level of discussion of what Rust does to accomplish its goals, various companies’ experience using Rust in their production code environments, and the side-effects of the major design decisions in Rust.
Unlike other modern compiled languages that use a Garbage Collector, like Go, Rust avoids GC because it removes control provided by deterministic destruction of resources, requires an inefficient runtime, and because it is not effective at solving many other types of memory and data issues. Rust’s core distinct feature is its memory management using a system of ownership and borrowing.
Rust also provides a modern set of tools both within the language and as additional officially maintained applications to set it apart from the languages it intends to replace.
One of Rust’s key focuses is reliability, and it shows strongly in the feedback from the production users of the language. Through its strong typing system and enforcement of resource ownership, Rust is able to guarantee that common memory errors like dangling pointers, aliasing, and invalidated iterators do not occur. This class of bugs is the most common in critical security issues of applications written in lower level languages.[4, 52:00]
This reliability does not come without its costs, however. In its current form Rust’s resource ownership paradigm can make the language difficult to read and write initially. In addition, using the compiler to enforce the strict typing and ownership as well as to resolve the abstractions the language provides adds a fairly significant compile-time cost to using the language.
While the strict rules and compiler can make this language time consuming, these costs are often quickly recovered thanks to the lack of time spent on debugging hard-to-find memory errors. In addition to this, the strong Rust community is very welcoming and helpful to newcomers, which helps further drive down the initial cost of learning the language.
Rust’s core memory paradigms also make implementing parallel systems very seamless. In fact, many major parallel methods flow very naturally from the core concepts of Rust. For example, locking a Mutex is just like the mutable borrow, and the concepts used for managing readers and writers in a parallelized database can be drawn from the overall system of borrowing where readers use shared borrows and the writers take mutable borrows.
While it is unlikely that larger companies will abandon their C and C++ code like MaidSafe has[4, 27:15] or Mozilla plans to, Rust has definitely found a strong starting point as a niche language that provides systems-level performance to groups that have stringent safety and correctness requirements.
Rust is still quite a young language, with its first stable release less than two years ago, and while it has seen adoption by several major companies it still has a ways to go before reaches the mainstream. Rust’s use in production will likely continue to be a hot topic in the years to come.
This project also required the submission of a final poster version: Download [pdf | 156kB]