Rollup merge of #132076 - RalfJung:feature-hashing, r=nnethercote,Mark-Simulacrum

HashStable for rustc_feature::Features: stop hashing compile-time constant

It seems like back in 542bc75dea this was added as "hash the boolean value of each lang feature", but then in 1487bd6a17 this got split into first hashing a sequence of `bool`s (representing all the features) and then hashing all the feature names... but the list of feature names is a compile-time constant, so it seems entirely unnecessary to hash them?

Cc `@Mark-Simulacrum` who wrote the second of the commits mentioned above.
Cc `@nnethercote`
This commit is contained in:
Stuart Cook 2024-10-24 14:19:57 +11:00 committed by GitHub
commit 006a14230f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,13 +111,8 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::Features {
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
// Unfortunately we cannot exhaustively list fields here, since the
// struct is macro generated.
// struct has private fields (to ensure its invariant is maintained)
self.enabled_lang_features().hash_stable(hcx, hasher);
self.enabled_lib_features().hash_stable(hcx, hasher);
// FIXME: why do we hash something that is a compile-time constant?
for feature in rustc_feature::UNSTABLE_LANG_FEATURES.iter() {
feature.name.hash_stable(hcx, hasher);
}
}
}