Skip to content

Commit ad0e6ad

Browse files
committed
fixes to indexed_set: add comments and fix PhantomData def'n.
1 parent a28771c commit ad0e6ad

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/librustc_borrowck/indexed_set.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,21 @@ use std::ops::{Deref, DerefMut, Range};
1717
use bitslice::{BitSlice, Word};
1818
use bitslice::{bitwise, Union, Subtract};
1919

20+
/// Represents some newtyped `usize` wrapper.
21+
///
22+
/// (purpose: avoid mixing indexes for different bitvector domains.)
2023
pub trait Idx: 'static {
2124
fn new(usize) -> Self;
2225
fn idx(&self) -> usize;
2326
}
2427

28+
/// Represents a set (or packed family of sets), of some element type
29+
/// E, where each E is identified by some unique index type `T`.
30+
///
31+
/// In other words, `T` is the type used to index into the bitvector
32+
/// this type uses to represent the set of object it holds.
2533
pub struct OwnIdxSet<T: Idx> {
26-
_pd: PhantomData<fn(&[T], usize) -> &T>,
34+
_pd: PhantomData<fn(&T)>,
2735
bits: Vec<Word>,
2836
}
2937

@@ -40,8 +48,13 @@ impl<T: Idx> Clone for OwnIdxSet<T> {
4048
// requires a transmute relying on representation guarantees that may
4149
// not hold in the future.
4250

51+
/// Represents a set (or packed family of sets), of some element type
52+
/// E, where each E is identified by some unique index type `T`.
53+
///
54+
/// In other words, `T` is the type used to index into the bitslice
55+
/// this type uses to represent the set of object it holds.
4356
pub struct IdxSet<T: Idx> {
44-
_pd: PhantomData<fn(&[T], usize) -> &T>,
57+
_pd: PhantomData<fn(&T)>,
4558
bits: [Word],
4659
}
4760

0 commit comments

Comments
 (0)