diff options
| author | bors <bors@rust-lang.org> | 2025-02-04 03:07:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-04 03:07:00 +0000 |
| commit | c705b7d6f748823352f95247835a5839dcbd7bed (patch) | |
| tree | 089bd9ceb827c1f18e3c49099da6560e718aef33 /compiler/rustc_data_structures/src/vec_cache.rs | |
| parent | affdb59607566c1615c829eea9e7b27a093994ec (diff) | |
| parent | 1869633ea248d7e30002c6fb1bd23a567275872a (diff) | |
| download | rust-c705b7d6f748823352f95247835a5839dcbd7bed.tar.gz rust-c705b7d6f748823352f95247835a5839dcbd7bed.zip | |
Auto merge of #136507 - matthiaskrgr:rollup-uzwv9mo, r=matthiaskrgr
Rollup of 8 pull requests
Successful merges:
- #136289 (OnceCell & OnceLock docs: Using (un)initialized consistently)
- #136299 (Ignore NLL boring locals in polonius diagnostics)
- #136411 (Omit argument names from function pointers that do not have argument names)
- #136430 (Use the type-level constant value `ty::Value` where needed)
- #136476 (Remove generic `//@ ignore-{wasm,wasm32,emscripten}` in tests)
- #136484 (Notes on types/traits used for in-memory query caching)
- #136493 (platform-support: document CPU baseline for x86-32 targets)
- #136498 (Update books)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_data_structures/src/vec_cache.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/vec_cache.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/vec_cache.rs b/compiler/rustc_data_structures/src/vec_cache.rs index eb251b587c8..2ff60ab7f36 100644 --- a/compiler/rustc_data_structures/src/vec_cache.rs +++ b/compiler/rustc_data_structures/src/vec_cache.rs @@ -206,6 +206,19 @@ impl SlotIndex { } } +/// In-memory cache for queries whose keys are densely-numbered IDs +/// (e.g `CrateNum`, `LocalDefId`), and can therefore be used as indices +/// into a dense vector of cached values. +/// +/// (As of [#124780] the underlying storage is not an actual `Vec`, but rather +/// a series of increasingly-large buckets, for improved performance when the +/// parallel frontend is using multiple threads.) +/// +/// Each entry in the cache stores the query's return value (`V`), and also +/// an associated index (`I`), which in practice is a `DepNodeIndex` used for +/// query dependency tracking. +/// +/// [#124780]: https://github.com/rust-lang/rust/pull/124780 pub struct VecCache<K: Idx, V, I> { // Entries per bucket: // Bucket 0: 4096 2^12 |
