{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreicvr32idx5xzqehq65fi7673tbw4p524uxfws4mjd6btmloy4qz2m",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3montye7hoct2"
  },
  "path": "/t/err-automatic-hint-cold-path/24404#post_1",
  "publishedAt": "2026-06-19T15:37:08.000Z",
  "site": "https://internals.rust-lang.org",
  "textContent": "Looking at this convert function, I was surprised that it doesn’t have a `hint::cold_path`. IMHO both consuming and producing an error, doubly make the second branch a candidate. OTOH, if it didn’t have the const-hack, a `?` would offer no place to put the hint. That makes me wonder, whether just like for `panic!()` that happens automatically.\n\n\n    pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {\n        // FIXME(const-hack): This should use `?` again, once it's `const`\n        match run_utf8_validation(v) {\n            Ok(_) => {\n                // SAFETY: validation succeeded.\n                Ok(unsafe { from_utf8_unchecked(v) })\n            }\n            Err(err) => Err(err),\n        }\n    }\n\n\nThat raises the question: what about `None`. That might be more common than `Err`. But is it common enough to make an automatically inserted `hint::cold_path` counterproductive?",
  "title": "Err automatic hint::cold_path?"
}