Why can’t I use a key function that returns a reference when sorting a vector with sort_by_key?
For now, you have to use the “long” form: v.sort_by(|x, y| key(x).cmp(&key(y))); Why am I getting these errors? Is there any way to fix them? The cause and fix are one-and-the same: Rust is simply not currently expressive enough to represent what you want. The feature needed is called generic associated types (GATs); previously known … Read more