diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2018-07-22 19:23:39 +0300 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2018-07-25 06:38:19 +0300 |
| commit | 145155dc96757002c7b2e9de8489416e2fdbbd57 (patch) | |
| tree | 1f17f8184ace880aad66fb6d9d4562a1a48fe652 /src/librustc_data_structures/transitive_relation.rs | |
| parent | a54401ebccc5497497b669a1c48fabdf7351d7b2 (diff) | |
| download | rust-145155dc96757002c7b2e9de8489416e2fdbbd57.tar.gz rust-145155dc96757002c7b2e9de8489416e2fdbbd57.zip | |
parameterize `BitVector` and `BitMatrix` by their index types
Diffstat (limited to 'src/librustc_data_structures/transitive_relation.rs')
| -rw-r--r-- | src/librustc_data_structures/transitive_relation.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs index 6d63bc4436f..a8124fb7c5b 100644 --- a/src/librustc_data_structures/transitive_relation.rs +++ b/src/librustc_data_structures/transitive_relation.rs @@ -39,7 +39,7 @@ pub struct TransitiveRelation<T: Clone + Debug + Eq + Hash> { // are added with new elements. Perhaps better would be to ask the // user for a batch of edges to minimize this effect, but I // already wrote the code this way. :P -nmatsakis - closure: Lock<Option<BitMatrix>>, + closure: Lock<Option<BitMatrix<usize, usize>>>, } #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug)] @@ -354,7 +354,7 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> { } fn with_closure<OP, R>(&self, op: OP) -> R - where OP: FnOnce(&BitMatrix) -> R + where OP: FnOnce(&BitMatrix<usize, usize>) -> R { let mut closure_cell = self.closure.borrow_mut(); let mut closure = closure_cell.take(); @@ -366,7 +366,7 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> { result } - fn compute_closure(&self) -> BitMatrix { + fn compute_closure(&self) -> BitMatrix<usize, usize> { let mut matrix = BitMatrix::new(self.elements.len(), self.elements.len()); let mut changed = true; @@ -396,7 +396,7 @@ impl<T: Clone + Debug + Eq + Hash> TransitiveRelation<T> { /// - Input: `[a, b, x]`. Output: `[a, x]`. /// - Input: `[b, a, x]`. Output: `[b, a, x]`. /// - Input: `[a, x, b, y]`. Output: `[a, x]`. -fn pare_down(candidates: &mut Vec<usize>, closure: &BitMatrix) { +fn pare_down(candidates: &mut Vec<usize>, closure: &BitMatrix<usize, usize>) { let mut i = 0; while i < candidates.len() { let candidate_i = candidates[i]; |
