1
Fork 0

Introduce Enabled{Lang,Lib}Feature

Instead of passing around random n-tuples of e.g. `(gate_name, attr_sp,
since)`.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-24 23:53:08 +08:00
parent 5ae4d75eff
commit 3528149f73
7 changed files with 101 additions and 51 deletions

View file

@ -116,3 +116,20 @@ impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::Features {
self.enabled_lib_features().hash_stable(hcx, hasher);
}
}
impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::EnabledLangFeature {
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
let rustc_feature::EnabledLangFeature { gate_name, attr_sp, stable_since } = self;
gate_name.hash_stable(hcx, hasher);
attr_sp.hash_stable(hcx, hasher);
stable_since.hash_stable(hcx, hasher);
}
}
impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::EnabledLibFeature {
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
let rustc_feature::EnabledLibFeature { gate_name, attr_sp } = self;
gate_name.hash_stable(hcx, hasher);
attr_sp.hash_stable(hcx, hasher);
}
}