{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifn7sxjoo2bybsnggmtg3qjaa3tkl6qzj2b3pur5ebhieqv5spmpy",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mgromw47ph72"
  },
  "path": "/t/stop-including-string-content-in-index-panics/24067#post_5",
  "publishedAt": "2026-03-10T19:27:11.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "@scottmcm"
  ],
  "textContent": "> I assume this is about not wanting to handle PI? Couldn't your crash reporter filter this out on the client side with a regex, at least as a stop-gap solution?\n\nWe definitely can, but I'm a bit reluctant to as a permanent solution in case someone (like me) messes with the panic messages more.\n\n> Echoing the _whole_ string seems clearly wrong and unnecessary, so at least this one I think we should just do. Maybe make a PR for that part and we can nominate for libs/libs-api discussion? (Feel free to `r? @scottmcm`.)\n\nIt's currently limited to 256 bytes; reducing the size would help (but it'd be better to get rid of it I think). For the range being backward, it's nothing to do with the string content.\n\n> The _single USV_ , however, does seem particularly useful as friendliness to the developer, _especially_ the new developer not yet used to how rust does indexing, so I'd be more reticent to remove the \"inside 'ã'\" part. (Removing the \"of `ãchoo`\" part seems obvious, like the previous case.)\n\nThat seems like a reasonable compromise to me too.\n\nSo I think that would leave us with the following panic strings:\n\n  * \"byte index {} is out of bounds for string of length {}\"\n  * \"byte range starts at {} but ends at {}\"\n  * \"byte index {} inside multibyte character {:?} (bytes {}..{} of string)\"\n\n\n\nThe first one is the main one where I think there's (maybe?) value in outputting the string content; but this does mirror what we do for slices already, so maybe it's OK to avoid it there too.\n\nI'll send a PR and we can discuss more the trade-offs there",
  "title": "Stop including string content in index panics?"
}