{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiencuruyzno3n57mzabffly2u36jqyyn4ybyx22ecppagkhxhdpvq",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3moyfkhvlep52"
  },
  "path": "/t/err-automatic-hint-cold-path/24404#post_3",
  "publishedAt": "2026-06-23T18:04:16.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "github.com/dtolnay/anyhow",
    "src/error.rs",
    "d9dc3faf7"
  ],
  "textContent": "The other thing that people are _already_ doing here is doing this specifically for error types.\n\nIf you look in `anyhow`, for example:\n\ngithub.com/dtolnay/anyhow\n\n#### src/error.rs\n\nd9dc3faf7\n\n\n\n\n\n\n        673. #[cfg(any(feature = \"std\", not(anyhow_no_core_error)))]\n\n\n        674. impl<E> From<E> for Error\n\n\n        675. where\n\n\n        676.     E: StdError + Send + Sync + 'static,\n\n\n        677. {\n\n\n        678.     #[cold]\n\n\n        679.     fn from(error: E) -> Self {\n\n\n        680.         let backtrace = backtrace_if_absent!(&error);\n\n\n        681.         Error::construct_from_std(error, backtrace)\n\n\n        682.     }\n\n\n        683. }\n\n\n\n\n\nThat's marked `#[cold]` so if you're using `anyhow` then any time `?` wraps an error into an `anyhow::Error` it's already treated as cold automatically.\n\nWhich is nice in that it's specific to that error type, since _for anyhow_ it definitely makes sense -- anything non-cold probably shouldn't be taking backtraces and such anyhow.",
  "title": "Err automatic hint::cold_path?"
}