diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-10-30 17:20:08 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-11-01 17:02:51 +0000 |
| commit | 15d2f62bd2b0a5cf928848ada93200b0328a8188 (patch) | |
| tree | 0260556b5c2c22a9b8f4792e1cff4f6ce2c99536 /compiler/rustc_middle/src | |
| parent | aee4d132e75b5dbd22d98299c0c373cd92b08749 (diff) | |
| download | rust-15d2f62bd2b0a5cf928848ada93200b0328a8188.tar.gz rust-15d2f62bd2b0a5cf928848ada93200b0328a8188.zip | |
Use VecCache for LocalDefId.
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/query.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/query.rs b/compiler/rustc_middle/src/ty/query.rs index 3258d7fc41d..985d396a2d0 100644 --- a/compiler/rustc_middle/src/ty/query.rs +++ b/compiler/rustc_middle/src/ty/query.rs @@ -120,6 +120,14 @@ macro_rules! query_helper_param_ty { } macro_rules! query_storage { + // FIXME(cjgillot) this macro-based way to perform type-based dispatch is clearly brittle. + // It should probably be replaced by an associated type on the `Key` trait. + ([][CrateNum, $V:ty]) => { VecCache<CrateNum, $V> }; + ([(arena_cache) $($rest:tt)*][CrateNum, $V:ty]) => { VecArenaCache<'tcx, CrateNum, $V> }; + ([][LocalDefId, $V:ty]) => { VecCache<LocalDefId, $V> }; + ([(arena_cache) $($rest:tt)*][LocalDefId, $V:ty]) => { VecArenaCache<'tcx, LocalDefId, $V> }; + ([][hir::OwnerId, $V:ty]) => { VecCache<hir::OwnerId, $V> }; + ([(arena_cache) $($rest:tt)*][hir::OwnerId, $V:ty]) => { VecArenaCache<'tcx, hir::OwnerId, $V> }; ([][$K:ty, $V:ty]) => { DefaultCache<$K, $V> }; ([(arena_cache) $($rest:tt)*][$K:ty, $V:ty]) => { ArenaCache<'tcx, $K, $V> }; ([$other:tt $($modifiers:tt)*][$($args:tt)*]) => { query_storage!([$($modifiers)*][$($args)*]) }; |
