3 ms·
Because Rust doesn't let you compare references. Rather, comparing references actually compares the referred-to value (which requires that said value implements
by eridius 12y ago
Because Rust doesn't let you compare references. Rather, comparing references actually compares the referred-to value (which requires that said value implements the comparison operators).
What you can do is convert a reference into a raw C pointer `const T`, and then you can compare those addresses. But the reference type itself doesn't make any guarantees about the address, which means you can't make any assumption about the address of the resulting `const T`. Reference types only make guarantees about the semantics of the reference, and since you can't compare the pointer value of references, the pointer value is not something the reference type guarantees.