Skip to content

Commit

Permalink
Rollup merge of #132076 - RalfJung:feature-hashing, r=nnethercote,Mar…
Browse files Browse the repository at this point in the history
…k-Simulacrum

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

It seems like back in 542bc75 this was added as "hash the boolean value of each lang feature", but then in 1487bd6 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`
  • Loading branch information
Zalathar authored Oct 24, 2024
2 parents 8f354fc + 0304809 commit 006a142
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions compiler/rustc_query_system/src/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,8 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
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);
}
}
}

0 comments on commit 006a142

Please sign in to comment.