{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreif55en4vc4vs2qoa7tarepctnybor7z5tsf76zbio2chkleplnvfe",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mpp4smpzs6p2"
  },
  "path": "/t/traits-for-function-items/22815#post_16",
  "publishedAt": "2026-07-02T22:18:42.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "Implementing traits on function pointers - #2 by steffahn - help - The Rust Programming Language Forum",
    "[1]",
    "↩︎"
  ],
  "textContent": "peter-lyons-kehl:\n\n> Suggest Implementing traits on function pointers - #2 by steffahn - help - The Rust Programming Language Forum ---> \" A possible workaround, using `unsafe` code, could be to check for a zero-sized and `Copy` type that implements `Fn`\n\nLooking back at my exact code from back then, I’m noticing that a zero-sized, `Copy` type might nonetheless still potentially\n\n  * carry a lifetime after which it must not be accessed anymore\n  * have `Send` restrictions, i.e. that it cannot be used from a different thread.\n\n\n\nThus for soundness, besides the (annoyingly monomorphization-time) zero-sizedness check, and the `F: Copy` bound, I would also add an `F: 'static` bound[1] as well as a `F: Send` bound.\n\n* * *\n\n  1. even though this does preclude some cases where things _would have been_ sound, such as some `fn foo<'a>(…) -> &'a Foo` function item instantiated for non-`'static` lifetime ↩︎\n\n\n",
  "title": "Traits for function items"
}