Conference Presentation, Lecture, Other
Will Crichton: Rust for Everyone!
- Research Objective: Will Creighton aims to make Rust more accessible to novices and experts alike by applying human-centered design and formal theories of cognition, rather than simplifying the language or reducing its power.
- The research focuses on making the design of programming languages and developer tools more scientific by incorporating cognitive science, moving beyond intuition-based design.
- The ultimate goal is to develop a "science of human-centered programming" that improves not only Rust but all programming languages.
- Project 1: Ownership Visualization (Aquascope)
- Problem: Rust developers frequently struggle with "ownership" and "borrowing," often relying on the Rust Book's ad-hoc rules that list what is "not allowed" rather than providing a constructive mental model.
- Solution: The team developed the "permissions model," which defines ownership through three core permissions: Read, Write, and Own.
- The model visualizes how these permissions dynamically change as borrows are created and dropped, making invisible lifetime rules visible in the code.
- Tool Implementation: "Aquascope" generates interactive diagrams showing the state of the borrow checker, allowing users to inspect permission changes line-by-line even in error-free code.
- Unlike other visualizations that focus solely on variable lifetimes (drawn as lines), Aquascope emphasizes the state of permissions on variables and their fields.
- Validation: A user study using a forked Rust Book with the new pedagogy showed that learners scored 9 percentage points higher on ownership quizzes compared to the baseline.
- The forked book has been used by approximately 150,000 people over three years for various learning experiments.
- Project 2: Trait Debugger (Argus)
- Problem: As codebases grow complex, Rust's standard trait error diagnostics become unmanageable, often overflowing screens and failing to clearly pinpoint the root cause of type inference failures.
- Solution: "Argus" visualizes the trait solver's inference tree interactively, allowing developers to explore the logical deduction process rather than staring at a wall of text.
- The tool offers multiple views (top-down and bottom-up) and hides non-essential metadata by default to reduce cognitive load.
- Validation: A user study demonstrated that developers using Argus could localize the root cause of trait errors three times faster than using standard compiler diagnostics.
- Use Case: Successfully applied to debug complex errors in the Bevy game framework where the standard compiler cannot easily disambiguate between competing trait implementations.
- Project 3: Program Slicing (Flow History)
- Problem: Understanding large functions requires filtering out irrelevant code; traditional static slicing is difficult to implement precisely in dynamic languages like Python due to aliasing and black-box function uncertainty.
- Solution: A Rust-specific program slicer that leverages the language's ownership and lifetime types to determine precise data flow and aliasing without inspecting library definitions.
- The tool uses lifetime annotations to infer that a mutable reference implies an alias, and mutability implies potential side effects, allowing it to slice through "black box" calls accurately.
- Accuracy: The tool is mathematically proven to be sound (finds all real dependencies) for the safe subset of Rust.
- On a dataset of 400,000 lines of real Rust code, the analysis produced identical results to a version that could inspect function bodies in 94% of cases.
- The tool is unsound only in specific cases involving
unsafeRust features like interior mutability.
- Future Directions & Reflections:
- Async Complexity: The team notes that Rust's surveys recently identified async/await (specifically the interaction with lifetimes) as the new primary learning barrier, surpassing ownership.
- Current research focuses on characterizing the async design space and clarifying the conceptual nexus of futures, coroutines, and cancellation.
- Dynamic Languages: The speaker highlights the gap between theoretical gradual typing and practical implementation (e.g., TypeScript), suggesting future research should analyze the trade-off between development velocity and technical debt accumulation.
- AI & Automation: The speaker argues for an "augmentation" approach where tools explain code to humans rather than fully automating development, emphasizing the need for reliable, theoretically grounded tools over probabilistic AI methods.
- IDE Limitations: A significant barrier to advanced visualization is the dominance of Visual Studio Code, which restricts complex overlays; the speaker advocates for the wider adoption of CodeMirror to enable more creative, extensible developer tools.
- Async Complexity: The team notes that Rust's surveys recently identified async/await (specifically the interaction with lifetimes) as the new primary learning barrier, surpassing ownership.
- Key Citations & Resources:
- Aquascope (Ownership Visualization):
cel.cs.brown.edu/aquascope - Forked Rust Book:
rust-book.cs.brown.edu - Argus (Trait Debugger): Available via VS Code extension at
cognitive-engineering-lab/argus - Flow History (Slicing):
github.com/willcraydon/flow-history - Research funded by NSF, DARPA, and AWS.
- Aquascope (Ownership Visualization):