Understanding Futurelock in Rust Programming: How It Defeats Local Reasoning About Correctness
By
bcantrill
Slow-proofed and worth the wait. Worth its weight in flour.
Summary
The article discusses 'futurelock' in Rust programming, which is a problem similar to async cancellation that defeats Rust's goal of enabling local reasoning about correctness. Futurelock occurs when combining multiple components that individually seem correct but together create deadlock issues, particularly with Mutexes that might be buried deep in the codebase across different modules or packages. The article explains that there's no single abstraction or programming pattern to avoid, requiring developers to examine multiple layers of the stack simultaneously to identify these issues.
Key quotes
· 4 pulledfuturelock defeats Rust's goal of being able to reason locally about correctness
None of these by itself is wrong, but combining them results in futurelock
It could require looking across many layers of the stack at once to be able to see the problem
There's no one abstraction, construct, or programming pattern we can point to here and say 'never do this'
You might also wanna read
Xilem: An Experimental Reactive UI Framework for Rust
Xilem is an experimental Rust-native UI framework that provides a high-level reactive architecture for building GUI applications. It's inspi
Mousefood: An Embedded-Graphics Backend for Ratatui Terminal UI Library
Mousefood is a no-std embedded-graphics backend for Ratatui, a Rust terminal user interface library. It enables Ratatui widgets to be render
Writing Rust Error Handling Without External Dependencies
The article discusses Rust error handling approaches, focusing on using standard library features instead of popular third-party dependencie

Introducing Rust's Block Pattern: A Programming Idiom for Cleaner Code
The article introduces a programming idiom called the "block pattern" in Rust, which leverages Rust's feature that blocks are valid expressi
Defensive Programming Patterns in Rust: When "This Should Never Happen" Actually Does
The article discusses defensive programming patterns in Rust, focusing on how developers often use comments like "// this should never happe
Implementing Custom Error Types in Rust for Cleaner Axum Web Application Error Handling
This article provides a practical guide for Rust developers on implementing custom error types to simplify error handling in Axum web applic
