ENES

Rust

A fast programming language whose compiler refuses to build code with memory bugs.

Code passes through the Rust compiler, which stops a memory bug at the gate and lets only safe, fast code through to the program

Rust is a programming language that started at Mozilla and reached version 1.0 in 2015. It aims at the same jobs as C and C++: operating systems, browsers, databases, game engines, embedded devices, anything where speed and control over memory matter. What makes it different is that it is designed to prevent a whole family of memory bugs that have plagued those languages for decades.

In C and C++ the programmer manages memory by hand, and small mistakes, like using memory after freeing it or writing past the end of a buffer, cause crashes and many serious security holes. Languages like Java or Python avoid that with a garbage collector, which costs some speed and predictability. Rust takes a third path: strict rules about which part of the code owns each piece of data and who may borrow it. The compiler's borrow checker enforces those rules, so most of those bugs simply do not compile, and the final program runs as fast as C.

The price is a steep learning curve: the compiler says no often, especially at first. Even so, Rust has gained ground quickly. It is part of the Linux kernel, Windows and Android; companies like AWS, Cloudflare and Microsoft use it in critical services; and security agencies recommend memory-safe languages like it for new code. It comes with cargo, a tool that builds projects and manages libraries.

Keep in mind

Go deeper

Related terms

More in Software