Skip to content

Commit 3e9d3d9

Browse files
committed
add From impls for BitSet and GrowableBitSet
1 parent 2d1e075 commit 3e9d3d9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

compiler/rustc_index/src/bit_set.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ impl<T: Idx> BitRelations<BitSet<T>> for BitSet<T> {
340340
}
341341
}
342342

343+
impl<T: Idx> From<GrowableBitSet<T>> for BitSet<T> {
344+
fn from(bit_set: GrowableBitSet<T>) -> Self {
345+
bit_set.bit_set
346+
}
347+
}
348+
343349
/// A fixed-size bitset type with a partially dense, partially sparse
344350
/// representation. The bitset is broken into chunks, and chunks that are all
345351
/// zeros or all ones are represented and handled very efficiently.
@@ -1469,6 +1475,12 @@ impl<T: Idx> GrowableBitSet<T> {
14691475
}
14701476
}
14711477

1478+
impl<T: Idx> From<BitSet<T>> for GrowableBitSet<T> {
1479+
fn from(bit_set: BitSet<T>) -> Self {
1480+
Self { bit_set }
1481+
}
1482+
}
1483+
14721484
/// A fixed-size 2D bit matrix type with a dense representation.
14731485
///
14741486
/// `R` and `C` are index types used to identify rows and columns respectively;

0 commit comments

Comments
 (0)