Negative Bounds for Avoiding Conflicts in Implementing Traits in Rust
summary
Introduces negative bounds (a minus operator on trait bounds) and a detection algorithm that checks unified type params plus the overlap of positive and excluded ancestor traits to avoid impl conflicts; prototype parser/resolver is implemented (~868 lines) and demonstrated resolving conflicts that previously required duplicate impls, with a claim of only adding an S·n·log n overhead and no major compile-time impact in typical cases; authors found >900 GitHub issues and tie the idea to RFC 1210 / rustc specialization.
AI-written summary · about
chapters (10)
- 0:00Negative bounds in Rust traits
- 1:05What are Rust traits
- 2:50Trait conflicts with type parameters
- 4:38Negative bounds to resolve conflicts
- 6:49Formal definition of trait conflicts
- 7:57Prototype implementation demo
- 10:51Complexity of checking algorithm
- 11:35Future work and plans
- 12:18Summary of solution
- 12:38Question and answer session begins
related talks
30mDebugging Trait Errors as Logic Programs
36mRust's trait system is a proof engine, let's make it prove us an ABI!
25mType System Tips for the Real World
49mThe Eternal Sunshine of the Spotless Programming Language
10mAutomatically Enforcing Rust Trait Properties
19mType Theory for the Working Rustacean
19mRust Without Tears: A Guide to Avoiding Common Traps
31mThe Rust That Could Have Been
