{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreihb4ffrmgdmzvmjbzm4j2xllftenyzr5ebe4qptnd3d2dv3pvvkme",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mjng74p2j3l2"
  },
  "path": "/t/t-sort-by-index-and-t-sort-by-key-and-index/24172#post_17",
  "publishedAt": "2026-04-16T21:30:42.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "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.",
  "title": "`<[T]>::sort_by_index` and `<[T]>::sort_by_key_and_index`"
}