Skip to content

Commit

Permalink
Apply feedback from rust-lang/rust#56241
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Mar 5, 2019
1 parent 4f1cfb0 commit 5d1d4e9
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 164 deletions.
12 changes: 2 additions & 10 deletions src/external_trait_impls/rayon/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pub struct RawParIter<T> {
iter: RawIterRange<T>,
}

unsafe impl<T> Send for RawParIter<T> {}

impl<T> ParallelIterator for RawParIter<T> {
type Item = Bucket<T>;

Expand All @@ -35,8 +33,6 @@ struct ParIterProducer<T> {
iter: RawIterRange<T>,
}

unsafe impl<T> Send for ParIterProducer<T> {}

impl<T> UnindexedProducer for ParIterProducer<T> {
type Item = Bucket<T>;

Expand All @@ -62,8 +58,6 @@ pub struct RawIntoParIter<T> {
table: RawTable<T>,
}

unsafe impl<T> Send for RawIntoParIter<T> {}

impl<T: Send> ParallelIterator for RawIntoParIter<T> {
type Item = T;

Expand All @@ -87,8 +81,8 @@ impl<T: Send> ParallelIterator for RawIntoParIter<T> {

/// Parallel iterator which consumes elements without freeing the table storage.
pub struct RawParDrain<'a, T> {
// We don't use a &'a RawTable<T> because we want RawParDrain to be
// covariant over 'a.
// We don't use a &'a mut RawTable<T> because we want RawParDrain to be
// covariant over T.
table: NonNull<RawTable<T>>,
_marker: PhantomData<&'a RawTable<T>>,
}
Expand Down Expand Up @@ -126,8 +120,6 @@ struct ParDrainProducer<T> {
iter: RawIterRange<T>,
}

unsafe impl<T: Send> Send for ParDrainProducer<T> {}

impl<T: Send> UnindexedProducer for ParDrainProducer<T> {
type Item = T;

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#![warn(missing_docs)]

#[cfg(test)]
#[cfg_attr(feature = "rayon", macro_use)]
extern crate std;
#[cfg(test)]
extern crate rand;
Expand All @@ -41,6 +40,7 @@ extern crate serde;
#[cfg_attr(test, macro_use)]
extern crate std as alloc;

mod scopeguard;
mod external_trait_impls;
mod fx;
mod map;
Expand Down
4 changes: 2 additions & 2 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ where
/// [`HashMap`]: struct.HashMap.html
pub struct Iter<'a, K: 'a, V: 'a> {
inner: RawIter<(K, V)>,
_marker: PhantomData<&'a HashMap<K, V>>,
_marker: PhantomData<(&'a K, &'a V)>,
}

// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
Expand Down Expand Up @@ -1122,7 +1122,7 @@ impl<'a, K: Debug, V: Debug> fmt::Debug for Iter<'a, K, V> {
pub struct IterMut<'a, K: 'a, V: 'a> {
inner: RawIter<(K, V)>,
// To ensure invariance with respect to V
_marker: PhantomData<&'a mut V>,
_marker: PhantomData<(&'a K, &'a mut V)>,
}

impl<'a, K, V> IterMut<'a, K, V> {
Expand Down
6 changes: 6 additions & 0 deletions src/raw/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ impl Group {
BitMask((self.0 & repeat(0x80)).to_le())
}

/// Returns a `BitMask` indicating all bytes in the group which are full.
#[inline]
pub fn match_full(&self) -> BitMask {
self.match_empty_or_deleted().invert()
}

/// Performs the following transformation on all bytes in the group:
/// - `EMPTY => EMPTY`
/// - `DELETED => EMPTY`
Expand Down
Loading

0 comments on commit 5d1d4e9

Please sign in to comment.