Commit Graph

11 Commits

Author SHA1 Message Date
Nicholas Nethercote ccc3c01162 Use Hcx/hcx consistently for StableHashingContext.
The `HashStable` and `ToStableHashKey` traits both have a type parameter
that is sometimes called `CTX` and sometimes called `HCX`. (In practice
this type parameter is always instantiated as `StableHashingContext`.)
Similarly, variables with these types are sometimes called `ctx` and
sometimes called `hcx`. This inconsistency has bugged me for some time.

The `HCX`/`hcx` form is more informative (the `H`/`h` indicates what
type of context it is) and it matches other cases like `tcx`, `dcx`,
`icx`.

Also, RFC 430 says that type parameters should have names that are
"concise UpperCamelCase, usually single uppercase letter: T". In this
case `H` feels insufficient, and `Hcx` feels better.

Therefore, this commit changes the code to use `Hcx`/`hcx` everywhere.
2026-03-31 20:16:57 +11:00
Rémy Rakic a13354bea0 rename BitSet to DenseBitSet
This should make it clearer that this bitset is dense, with the
advantages and disadvantages that it entails.
2025-01-11 11:34:01 +00:00
Urgau 977439d9b8 Use uplifted rustc-stable-hash crate in rustc_data_structures 2024-07-11 16:51:16 +02:00
Ben Kimock 0445fbdd83 Store hashes in special types so they aren't accidentally encoded as numbers 2023-04-18 10:52:47 -04:00
Thom Chiovoloni 9d314627aa Fix a couple missed hash constants 2023-04-05 15:48:37 +00:00
est31 ef658907a5 Match end user facing unmatched backticks in compiler/ 2023-03-03 08:39:36 +01:00
Jakub Beránek c21b8e12a4 Fix isize optimization in StableHasher for big-endian architectures 2022-02-03 11:47:41 +01:00
Jakub Beránek 8de59be933 Compress amount of hashed bytes for isize values in StableHasher 2022-01-30 09:52:44 +01:00
Jakub Beránek 1ffd043caf Add test stable hash uniqueness of adjacent field values 2022-01-24 15:35:52 +01:00
Tomasz Miąsko d0281bcb25 Implement StableHash for BitSet and BitMatrix via Hash
This fixes an issue where bit sets / bit matrices the same word
content but a different domain size would receive the same hash.
2021-12-18 00:00:00 +00:00
Tyson Nottingham d061fee177 Stable hashing: add comments and tests concerning platform-independence
SipHasher128 implements short_write in an endian-independent way, yet
its write_xxx Hasher trait methods undo this endian-independence by byte
swapping the integer inputs on big-endian hardware. StableHasher then
adds endian-independence back by also byte-swapping on big-endian
hardware prior to invoking SipHasher128.

This double swap may have the appearance of being a no-op, but is in
fact by design. In particular, we really do want SipHasher128 to be
platform-dependent, in order to be consistent with the libstd SipHasher.
Try to clarify this intent. Also, add and update a couple of unit tests.
2020-09-30 00:57:35 -07:00