about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2016-05-25 15:53:59 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2016-05-25 15:53:59 +0200
commitad0e6adbb1453d7e0abe6d3f279b005036d4faa3 (patch)
tree0ca9019d9cdf0eb60a93c2aeab560a8d87c83c49
parenta28771cc971a0b750984a3ebd67402e21892566c (diff)
fixes to `indexed_set`: add comments and fix `PhantomData` def'n.
-rw-r--r--src/librustc_borrowck/indexed_set.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/librustc_borrowck/indexed_set.rs b/src/librustc_borrowck/indexed_set.rs
index 5e842c1c5ab..2625bd4300c 100644
--- a/src/librustc_borrowck/indexed_set.rs
+++ b/src/librustc_borrowck/indexed_set.rs
@@ -17,13 +17,21 @@ use std::ops::{Deref, DerefMut, Range};
 use bitslice::{BitSlice, Word};
 use bitslice::{bitwise, Union, Subtract};
 
+/// Represents some newtyped `usize` wrapper.
+///
+/// (purpose: avoid mixing indexes for different bitvector domains.)
 pub trait Idx: 'static {
     fn new(usize) -> Self;
     fn idx(&self) -> usize;
 }
 
+/// Represents a set (or packed family of sets), of some element type
+/// E, where each E is identified by some unique index type `T`.
+///
+/// In other words, `T` is the type used to index into the bitvector
+/// this type uses to represent the set of object it holds.
 pub struct OwnIdxSet<T: Idx> {
-    _pd: PhantomData<fn(&[T], usize) -> &T>,
+    _pd: PhantomData<fn(&T)>,
     bits: Vec<Word>,
 }
 
@@ -40,8 +48,13 @@ impl<T: Idx> Clone for OwnIdxSet<T> {
 // requires a transmute relying on representation guarantees that may
 // not hold in the future.
 
+/// Represents a set (or packed family of sets), of some element type
+/// E, where each E is identified by some unique index type `T`.
+///
+/// In other words, `T` is the type used to index into the bitslice
+/// this type uses to represent the set of object it holds.
 pub struct IdxSet<T: Idx> {
-    _pd: PhantomData<fn(&[T], usize) -> &T>,
+    _pd: PhantomData<fn(&T)>,
     bits: [Word],
 }