-
Notifications
You must be signed in to change notification settings - Fork 522
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
Explain all the stable hashing shenanigans #203
Comments
I was told that @michaelwoerister knows all about this? :D |
Our Stability here is across compilations, and it means the hash depends on semantic data, not transient representation. |
What kind of "ID" are you referring to? |
Okay so "stable" here means "guaranteed not to change between rustc invocations". We must not hash pointers, for example. Good to know. |
"Stable" here means stable across compilation sessions and crate boundaries. For example, if you This is used for telling if something has changed in between to sessions (for incr. comp.) without actually having to have the value stored somewhere. Another example is the hash value at the end of every Rust symbol. This also needs be stable across sessions and crate boundaries. |
@michaelwoerister thanks, that helps! Why does this kind of stability require access to a "context" ( |
@RalfJung To cache some kinds of more expensive hashes and to look up IDs ( |
It's not just caching. |
That's what I meant by "looking up IDs". |
Right, I wasn't reading your answer properly |
So rustc is full of these
impl_stable_hash_for
. What are these for? I originally thought that would be forFxHashMap
, but that seems to be wrong (I still need toderive(Hash)
to useFxHashMap
). So now I am just confused. It would be great if the guide could explain that.@eddyb said "incremental" but that on its own does not explain much of anything -- why is
Hash
not good enough? Why do I need atcx
to compute a "stable hash"?The text was updated successfully, but these errors were encountered: