You can't Do That: Abstracting over Ownership in Rust with Type Inference (and GATs Don't Help)

27 · Armin Ronacher · Sept. 8, 2022, 12:43 p.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. With the recent talk about stabilization of GATs I tried diving into the topic again and left quite disappointed. Let me make this less abstract and let's see what this is about...