about summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-10-24 23:53:08 +0800
committer许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-10-25 10:30:37 +0800
commit3528149f735e801eb5710585d5f3b4fa73d6e1e5 (patch)
treef6dd5cb897dd4fc7925fcfde370dd0be9d99625f /compiler/rustc_query_system
parent5ae4d75effa366176dd75cd0d5662da26385cfc5 (diff)
downloadrust-3528149f735e801eb5710585d5f3b4fa73d6e1e5.tar.gz
rust-3528149f735e801eb5710585d5f3b4fa73d6e1e5.zip
Introduce `Enabled{Lang,Lib}Feature`
Instead of passing around random n-tuples of e.g. `(gate_name, attr_sp,
since)`.
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/ich/impls_syntax.rs17
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);
+    }
+}