Skip to content

Commit 9c9a89a

Browse files
committed
Update documentation.
1 parent 262c8c9 commit 9c9a89a

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

compiler/rustc_index/src/bit_set.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,14 @@ pub struct ChunkedBitSet<T> {
491491
marker: PhantomData<T>,
492492
}
493493

494-
// Note: the chunk domain size is duplicated in each variant. This is a bit
495-
// inconvenient, but it allows the type size to be smaller than if we had an
496-
// outer struct containing a chunk domain size plus the `Chunk`, because the
497-
// compiler can place the chunk domain size after the tag.
494+
// NOTE: The chunk size is computed on-the-fly on each manipulation of a chunk.
495+
// This avoids storing it, as it's almost always CHUNK_BITS except for the last one.
498496
#[derive(Clone, Debug, PartialEq, Eq)]
499497
enum Chunk {
500498
/// A chunk that is all zeros; we don't represent the zeros explicitly.
501-
/// The `ChunkSize` is always non-zero.
502499
Zeros,
503500

504501
/// A chunk that is all ones; we don't represent the ones explicitly.
505-
/// `ChunkSize` is always non-zero.
506502
Ones,
507503

508504
/// A chunk that has a mix of zeros and ones, which are represented
@@ -514,9 +510,7 @@ enum Chunk {
514510
/// to store the length, which would make this type larger. These excess
515511
/// words are always zero, as are any excess bits in the final in-use word.
516512
///
517-
/// The first `ChunkSize` field is always non-zero.
518-
///
519-
/// The second `ChunkSize` field is the count of 1s set in the chunk, and
513+
/// The `ChunkSize` field is the count of 1s set in the chunk, and
520514
/// must satisfy `0 < count < chunk_domain_size`.
521515
///
522516
/// The words are within an `Rc` because it's surprisingly common to

0 commit comments

Comments
 (0)