diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-26 06:29:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-26 06:29:47 +0200 |
| commit | 8207d89b5e743b1c200a081d1556bb03174317db (patch) | |
| tree | e18bc8f52722ff53ed960518bf62604adcdde6a2 /compiler/rustc_query_system/src/ich/impls_syntax.rs | |
| parent | a06b7cbe21967a86050fa92dab843c8afda1c28e (diff) | |
| parent | 3528149f735e801eb5710585d5f3b4fa73d6e1e5 (diff) | |
| download | rust-8207d89b5e743b1c200a081d1556bb03174317db.tar.gz rust-8207d89b5e743b1c200a081d1556bb03174317db.zip | |
Rollup merge of #132114 - jieyouxu:features-bundle, r=fee1-dead
Use `Enabled{Lang,Lib}Feature` instead of n-tuples
Instead of passing around e.g. `(gate_name, attr_span, stable_since)` 3-tuples for enabled lang features or `(gate_name, attr_span)` 2-tuples for enabled lib features, use `Enabled{Lang,Lib}Feature` structs with named fields.
Also did some minor code-golfing of involved iterator chains to hopefully make them easier to follow.
Follow-up to https://github.com/rust-lang/rust/pull/132098#issuecomment-2434523431 cc `@RalfJung.`
Diffstat (limited to 'compiler/rustc_query_system/src/ich/impls_syntax.rs')
| -rw-r--r-- | compiler/rustc_query_system/src/ich/impls_syntax.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_query_system/src/ich/impls_syntax.rs b/compiler/rustc_query_system/src/ich/impls_syntax.rs index 0665401df8e..5a72e80a0a5 100644 --- a/compiler/rustc_query_system/src/ich/impls_syntax.rs +++ b/compiler/rustc_query_system/src/ich/impls_syntax.rs @@ -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); + } +} |
