You Can't Do That: Abstracting over Ownership in Rust with Higher-Rank Type Bounds. Or Can You?

287 · Armin Ronacher · Sept. 11, 2022, 9:44 a.m.
A few years ago I wrote about how to get better at Rust by knowing when what you want to do is impossible. Sadly in many ways I don't learn from my own mistakes and I keep running into a particular issue over and over again: Rust's restrictions about being able to abstract over the borrow status / ownership of a values in some hard to discover situations involving higher-kinded type bounds. A few days ago I wrote a (now unpublished) article about how you can't express a certain problem I keep m...