-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Url hash values have changed between 0.2.34 and 0.2.35 #117
Comments
I don’t know, are hash values significant? I’ve always thought of them as only meaningful for comparison with each other within one execution of a program and had not considered they could be relied on in anything serialized. Are they guaranteed to be the same on architectures? (Bit depth, endianness, etc.) |
Interesting question. Scenario: a bunch of website-hitting applications (let's say they're all written in rust) which contact a central caching server before actually making their requests. You need to choose a suitable cache key. My personal expectation would be that using a hash would be acceptable, since that's what hashmaps do. I'd (unthinkingly) expect this to work consistently for all minor/patch variations on library versions, and across different architectures. However, reading the documentation of the |
I've made my peace with this change after some discussion on rust internals - https://internals.rust-lang.org/t/stability-of-hash-values/2241. It seems like my understanding of 'hash' is different to the popular one, so I'll see if I can improve the documentation of the hash trait to better spell it out for people like me. |
The serialization of URLs should be much more stable (since it affect interoperability and has a spec) so I’d recommend basing your hashing on that rather than the built-in To avoid allocating a serialized string, you could have a specialized |
main.rs
Terminal session:
Note the editing Cargo.lock by hand -
url = "0.2.34"
in Cargo.toml is not sufficient.This is a pretty surprising change for a patch release! I'd expect a more significant version bump.
Possibly went unnoticed though? There don't seem to be any hashing tests.
The text was updated successfully, but these errors were encountered: