diff --git a/src/compiler/rust/bitset.rs b/src/compiler/rust/bitset.rs index a5226a1fb4c..f0327893b29 100644 --- a/src/compiler/rust/bitset.rs +++ b/src/compiler/rust/bitset.rs @@ -223,7 +223,7 @@ fn every_nth_bit(n: usize) -> u32 { impl BitSet { /// Evaluate an expression and store its value in self - pub fn assign(&mut self, value: BitSetStream) + pub fn assign(&mut self, value: BitSetStream) where B: BitSetStreamTrait, { @@ -242,7 +242,7 @@ impl BitSet { /// Returns true if the value of self changes, or false otherwise. If you /// don't need the return value of this function, consider using the `|=` /// operator instead. - pub fn union_with(&mut self, other: BitSetStream) -> bool + pub fn union_with(&mut self, other: BitSetStream) -> bool where B: BitSetStreamTrait, { @@ -263,10 +263,13 @@ impl BitSet { pub fn s<'a>( &'a self, _: RangeFull, - ) -> BitSetStream { - BitSetStream(BitSetStreamFromBitSet { - iter: self.words.iter().copied(), - }) + ) -> BitSetStream { + BitSetStream( + BitSetStreamFromBitSet { + iter: self.words.iter().copied(), + }, + PhantomData, + ) } } @@ -318,15 +321,15 @@ where } } -pub struct BitSetStream(T) +pub struct BitSetStream(T, PhantomData) where T: BitSetStreamTrait; -impl From> for BitSet +impl From> for BitSet where T: BitSetStreamTrait, { - fn from(value: BitSetStream) -> Self { + fn from(value: BitSetStream) -> Self { let mut out = BitSet::new(); out.assign(value); out @@ -371,26 +374,29 @@ macro_rules! binop { } } - impl $BinOp> for BitSetStream + impl $BinOp> for BitSetStream where A: BitSetStreamTrait, B: BitSetStreamTrait, { - type Output = BitSetStream<$Struct>; + type Output = BitSetStream<$Struct, K>; - fn $bin_op(self, rhs: BitSetStream) -> Self::Output { - BitSetStream($Struct { - a: self.0, - b: rhs.0, - }) + fn $bin_op(self, rhs: BitSetStream) -> Self::Output { + BitSetStream( + $Struct { + a: self.0, + b: rhs.0, + }, + PhantomData, + ) } } - impl $AssignBinOp> for BitSet + impl $AssignBinOp> for BitSet where B: BitSetStreamTrait, { - fn $assign_bin_op(&mut self, rhs: BitSetStream) { + fn $assign_bin_op(&mut self, rhs: BitSetStream) { let mut rhs = rhs.0; let $a_len = self.words.len();