`<[T]>::sort_by_index` and `<[T]>::sort_by_key_and_index`
Rust Internals [Unofficial]
April 14, 2026
To avoid internal allocation you could oblige caller to supply a scratch array of [usize; N].
Discussion in the ATmosphere