Understanding How Rust Programmers Use Unsafe Code

external page Rust is a new programming language that aims to be a safe replacement for C and C++. Therefore, the Rust type system provides strong guarantees such as a data race freedom. However, sometimes the type system is too restrictive, and as an escape hatch, Rust provides external page unsafe blocks and functions. On the one hand, the type system allows a programmer to do more things in the unsafe code; on the other hand, the programmer has to make sure that their unsafe code does not violate the type system's assumptions. Even though not violating these assumptions is critical for the correctness of many programs, the Rust community is still discussing what should be allowed in unsafe code and what should not. Therefore, there is a need for the community to understand how Rust programmers use unsafe code.

Goals

In a previous project, a external page prototype for analysing Rust code with Datalog like queries was developed. The goal of this project is to extend the prototype and analyse how Rust programmers use unsafe code and how this affects the safety of the Rust ecosystem. The milestones of this project are:

  1. Compute a sound over-approximation of the entire external page https://crates.io/ call-graph. This, for example, would allow computing an impact of a bug found in a unsafe block.
  2. Collect statistical information about unsafe code usage. For example:
    1. What proportion of Rust projects uses unsafe code?
    2. How often is an unsafe block used to avoid array bounds checks?
  3. Identify common syntactic patterns of unsafe code use.
  4. Classify all unsafe code uses based on the purpose for which the unsafe code is used. For example, one group could be all unsafe code that is used to interact with the code written in other programming languages.

Prerequisites

Since the project requires working with the Rust compiler's source code, it is necessary to already know Rust to be able to understand the compiler's sources in reasonable time.

Opportunities

The project offers the following opportunities:

  • Make an important contribution to the Rust community.
  • Gain experience with the Rust programming language.

Contacts

JavaScript has been disabled in your browser