about summary refs log tree commit diff
path: root/compiler/rustc_index
diff options
context:
space:
mode:
authorCamille Gillot <gillot.camille@gmail.com>2025-08-24 22:15:19 +0000
committerCamille Gillot <gillot.camille@gmail.com>2025-08-24 22:15:19 +0000
commit9c9a89a18afc97f1c9544d3cf709999a9c106417 (patch)
tree1b85ae639a1a7f8026e5373469866847cfb4b888 /compiler/rustc_index
parent262c8c92387f946449ecee1733580906aec0aa57 (diff)
downloadrust-9c9a89a18afc97f1c9544d3cf709999a9c106417.tar.gz
rust-9c9a89a18afc97f1c9544d3cf709999a9c106417.zip
Update documentation.
Diffstat (limited to 'compiler/rustc_index')
-rw-r--r--compiler/rustc_index/src/bit_set.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs
index 3b03296e5c0..684bd34f909 100644
--- a/compiler/rustc_index/src/bit_set.rs
+++ b/compiler/rustc_index/src/bit_set.rs
@@ -491,18 +491,14 @@ pub struct ChunkedBitSet<T> {
     marker: PhantomData<T>,
 }
 
-// Note: the chunk domain size is duplicated in each variant. This is a bit
-// inconvenient, but it allows the type size to be smaller than if we had an
-// outer struct containing a chunk domain size plus the `Chunk`, because the
-// compiler can place the chunk domain size after the tag.
+// NOTE: The chunk size is computed on-the-fly on each manipulation of a chunk.
+// This avoids storing it, as it's almost always CHUNK_BITS except for the last one.
 #[derive(Clone, Debug, PartialEq, Eq)]
 enum Chunk {
     /// A chunk that is all zeros; we don't represent the zeros explicitly.
-    /// The `ChunkSize` is always non-zero.
     Zeros,
 
     /// A chunk that is all ones; we don't represent the ones explicitly.
-    /// `ChunkSize` is always non-zero.
     Ones,
 
     /// A chunk that has a mix of zeros and ones, which are represented
@@ -514,9 +510,7 @@ enum Chunk {
     /// to store the length, which would make this type larger. These excess
     /// words are always zero, as are any excess bits in the final in-use word.
     ///
-    /// The first `ChunkSize` field is always non-zero.
-    ///
-    /// The second `ChunkSize` field is the count of 1s set in the chunk, and
+    /// The `ChunkSize` field is the count of 1s set in the chunk, and
     /// must satisfy `0 < count < chunk_domain_size`.
     ///
     /// The words are within an `Rc` because it's surprisingly common to