But I don't think the behavior is documented anywhere so that I could rely on it.
Is anyone aware if the behavior is documented when it comes to function address?
It's interesting that, if the function really does something depending on the type, the addresses will be different even in release: Rust Playground This is understandable, since compiler must generate code for every of them, so maybe in this case the difference might be reliable.
LLVM doesn't even know that they come from the same generic source when it deduplicates them... which means even completely distinct functions can end up sharing the same code location if the optimizer chooses.
Pointer uniqueness of function is non-deterministic actually.
In my opinion, PartialEq and Hash shouldn't be implemented for function pointers, but it's here, and it cannot be removed now. Also, because those are implementations, you cannot even deprecate those (see `#[deprecated]` does nothing if placed on an impl item. · Issue #39935 · rust-lang/rust · GitHub). That said, most programs don't compare function pointers (I think?), so this isn't that big of a deal.