Skip to content

Commit a1aa733

Browse files
committed
More review comments
1 parent b92a5b9 commit a1aa733

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

cranelift/bitset/src/compound.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,42 +477,42 @@ impl<T: ScalarBitSetStorage> CompoundBitSet<T> {
477477
/// # Example
478478
///
479479
/// ```
480-
/// use cranelift_bitset::CompoundBitSet;
480+
/// use cranelift_bitset::{CompoundBitSet, ScalarBitSet};
481481
///
482482
/// let mut bitset = CompoundBitSet::<u32>::default();
483483
///
484484
/// assert_eq!(
485-
/// bitset.iter_words().collect::<Vec<_>>(),
485+
/// bitset.iter_scalars().collect::<Vec<_>>(),
486486
/// [],
487487
/// );
488488
///
489489
/// bitset.insert(0);
490490
///
491491
/// assert_eq!(
492-
/// bitset.iter_words().collect::<Vec<_>>(),
493-
/// [0x1],
492+
/// bitset.iter_scalars().collect::<Vec<_>>(),
493+
/// [ScalarBitSet(0x1)],
494494
/// );
495495
///
496496
/// bitset.insert(1);
497497
///
498498
/// assert_eq!(
499-
/// bitset.iter_words().collect::<Vec<_>>(),
500-
/// [0x3],
499+
/// bitset.iter_scalars().collect::<Vec<_>>(),
500+
/// [ScalarBitSet(0x3)],
501501
/// );
502502
///
503503
/// bitset.insert(32);
504504
///
505505
/// assert_eq!(
506-
/// bitset.iter_words().collect::<Vec<_>>(),
507-
/// [0x3, 0x1],
506+
/// bitset.iter_scalars().collect::<Vec<_>>(),
507+
/// [ScalarBitSet(0x3), ScalarBitSet(0x1)],
508508
/// );
509509
/// ```
510-
pub fn iter_words(&self) -> impl Iterator<Item = T> + '_ {
510+
pub fn iter_scalars(&self) -> impl Iterator<Item = ScalarBitSet<T>> + '_ {
511511
let nwords = match self.max {
512512
Some(n) => 1 + (n as usize / Self::BITS_PER_SCALAR),
513513
None => 0,
514514
};
515-
self.elems.iter().map(|b| b.0).take(nwords)
515+
self.elems.iter().copied().take(nwords)
516516
}
517517
}
518518

crates/environ/src/compile/stack_maps.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ impl StackMapSection {
119119
assert!(offset % 4 == 0);
120120
bits.insert((offset / 4) as usize);
121121
}
122-
let count = bits.iter_words().count();
122+
let count = bits.iter_scalars().count();
123123
self.stack_map_data
124124
.push(U32Bytes::new(LittleEndian, count as u32));
125-
for word in bits.iter_words() {
126-
self.stack_map_data.push(U32Bytes::new(LittleEndian, word));
125+
for scalar in bits.iter_scalars() {
126+
self.stack_map_data
127+
.push(U32Bytes::new(LittleEndian, scalar.0));
127128
}
128129
}
129130

0 commit comments

Comments
 (0)