diff --git a/ci/run.sh b/ci/run.sh index fc8755c8f..39cf49c42 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -43,8 +43,8 @@ if [ "${CHANNEL}" = "nightly" ]; then fi # Make sure we can compile without the default hasher -"${CARGO}" -vv build --target="${TARGET}" --no-default-features --features raw-entry -"${CARGO}" -vv build --target="${TARGET}" --release --no-default-features --features raw-entry +"${CARGO}" -vv build --target="${TARGET}" --no-default-features +"${CARGO}" -vv build --target="${TARGET}" --release --no-default-features "${CARGO}" -vv ${OP} --target="${TARGET}" "${CARGO}" -vv ${OP} --target="${TARGET}" --features "${FEATURES}" diff --git a/src/lib.rs b/src/lib.rs index 482057d32..981cb6226 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,8 @@ mod raw; mod external_trait_impls; mod map; -#[cfg(feature = "raw-entry")] +// FIXME: gate this entire module when `HashSet` stops using it +// #[cfg(feature = "raw-entry")] mod raw_entry; #[cfg(feature = "rustc-internal-api")] mod rustc_entry; diff --git a/src/raw_entry.rs b/src/raw_entry.rs index 99fef6fa9..f930de296 100644 --- a/src/raw_entry.rs +++ b/src/raw_entry.rs @@ -1,3 +1,6 @@ +// FIXME: When not public, a lot is dead because `HashSet` only uses a fraction of the API +#![cfg_attr(not(feature = "raw-entry"), allow(dead_code))] + use crate::hash_map::{equivalent, make_hash, make_hasher}; use crate::raw::{Allocator, Bucket, Global, RawTable}; use crate::{Equivalent, HashMap}; @@ -103,11 +106,19 @@ impl HashMap { /// assert_eq!(map.get(&"d"), None); /// assert_eq!(map.len(), 2); /// ``` + #[cfg(feature = "raw-entry")] #[cfg_attr(feature = "inline-more", inline)] pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S, A> { RawEntryBuilderMut { map: self } } + // FIXME: this is still used in the `HashSet` implementation + #[cfg(not(feature = "raw-entry"))] + #[cfg_attr(feature = "inline-more", inline)] + pub(crate) fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S, A> { + RawEntryBuilderMut { map: self } + } + /// Creates a raw immutable entry builder for the HashMap. /// /// Raw entries provide the lowest level of control for searching and @@ -153,6 +164,7 @@ impl HashMap { /// } /// ``` #[cfg_attr(feature = "inline-more", inline)] + #[cfg(feature = "raw-entry")] pub fn raw_entry(&self) -> RawEntryBuilder<'_, K, V, S, A> { RawEntryBuilder { map: self } } diff --git a/src/set.rs b/src/set.rs index e5e9496ae..ef9a9d6ac 100644 --- a/src/set.rs +++ b/src/set.rs @@ -1599,10 +1599,10 @@ where for item in rhs { let entry = self.map.raw_entry_mut().from_key(item); match entry { - map::RawEntryMut::Occupied(e) => { + crate::raw_entry::RawEntryMut::Occupied(e) => { e.remove(); } - map::RawEntryMut::Vacant(e) => { + crate::raw_entry::RawEntryMut::Vacant(e) => { e.insert(item.to_owned(), ()); } };