Pointer errors have plagued software developers for decades. Rust’s innovative and expressive approach helps make pointers safe and efficient. Pointers have been a staple of programming languages since the earliest days of computing, serving two purposes:
• Indirection: a means to share (rather than copy) data values within a program. This can be implicit, for example by passing a variable as a “by reference” parameter, or explicit through syntax for reference creating / dereferencing (such as “&x” and “*p” in C).
• Dynamic allocation: a means to construct and manipulate data structures (linked lists, trees, graphs, …) that can grow and shrink during program execution. However, with power comes danger, and pointers can compromise both safety and performance. This paper investigates the challenges that pointers bring and explains how Rust meets these challenges.
Rust’s approach requires programmers to think about pointers in a new way, but the effect is memory safety / early detection of pointer errors and efficient performance, with the expressiveness of a general-purpose data structuring facility.