Please read the whole documents carefully when you write the unsafe code. Safe Rust is always safe, but unsafe Rust is only usable if you satisfy all the conditions the documents and the language specification provides.
Regarding the document, this is UB, specifically violating the third condition of the Safety section. So you cannot expect stable result on this operation. Moreover, the compiler may wipe out the whole code for the sake of the optimization.
Of course it can be calculated, simply by converting both addresses to usize integers and subtracting one from the other. What you can't do is fabricate an address from that integer result and then attempt to use it as a reference, because that step is almost always UB.