External Publication
Visit Post

`<[T]>::sort_by_index` and `<[T]>::sort_by_key_and_index`

Rust Internals [Unofficial] April 16, 2026
Source

One option could be to guarantee a panic on too large of an index or the wrong size permutation slice and state that duplicates (or, equivalently, missing values) can either cause a panic or any arbitrary permutation (or an even looser value guarantee if that is helpful for the algorithm) (but not undefined behavior), similar to what [T]::sort and similar methods guarantee.

Discussion in the ATmosphere

Loading comments...