A Grounded Conceptual Model for Ownership Types in Rust

09/08/2023
by   Will Crichton, et al.
0

Programmers learning Rust struggle to understand ownership types, Rust's core mechanism for ensuring memory safety without garbage collection. This paper describes our attempt to systematically design a pedagogy for ownership types. First, we studied Rust developers' misconceptions of ownership to create the Ownership Inventory, a new instrument for measuring a person's knowledge of ownership. We found that Rust learners could not connect Rust's static and dynamic semantics, such as determining why an ill-typed program would (or would not) exhibit undefined behavior. Second, we created a conceptual model of Rust's semantics that explains borrow checking in terms of flow-sensitive permissions on paths into memory. Third, we implemented a Rust compiler plugin that visualizes programs under the model. Fourth, we integrated the permissions model and visualizations into a broader pedagogy of ownership by writing a new ownership chapter for The Rust Programming Language, a popular Rust textbook. Fifth, we evaluated an initial deployment of our pedagogy against the original version, using reader responses to the Ownership Inventory as a point of comparison. Thus far, the new pedagogy has improved learner scores on the Ownership Inventory by an average of 9

READ FULL TEXT
research
04/17/2018

K-Rust: An Executable Formal Semantics for Rust

Rust is a system programming language designed for providing better memo...
research
04/27/2020

Static Race Detection and Mutex Safety and Liveness for Go Programs (extended version)

Go is a popular concurrent programming language thanks to its ability to...
research
06/14/2017

Failure-Directed Program Trimming (Extended Version)

This paper describes a new program simplification technique called progr...
research
11/14/2022

A Formal CHERI-C Semantics for Verification

CHERI-C extends the C programming language by adding hardware capabiliti...
research
03/02/2021

The Fusemate Logic Programming System (System Description)

Fusemate is a logic programming system that implements the possible mode...
research
11/18/2020

RustViz: Interactively Visualizing Ownership and Borrowing

Rust is a systems programming language that guarantees memory safety wit...
research
09/12/2023

REVIS: An Error Visualization Tool for Rust

Rust is a programming language that uses a concept of ownership to guara...

Please sign up or login with your details

Forgot password? Click here to reset