Skip to content

Commit

Permalink
feat(*): add support for old Rust versions
Browse files Browse the repository at this point in the history
  • Loading branch information
wvwwvwwv committed Jan 3, 2024
1 parent 6bd6a9d commit 5b2a4be
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .config/glossary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ updatable
vectorized
VM
Workflow
workflow
Xeon
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Version 2

2.0.8

* Add support for Rust 1.70.0.

2.0.7

* Add `bucket_index` to `HashIndex`, `HashMap`, and `HashSet`.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "scc"
description = "High performance containers and utilities for concurrent and asynchronous programming"
documentation = "https://docs.rs/scc"
version = "2.0.7"
version = "2.0.8"
authors = ["wvwwvwwv <[email protected]>"]
edition = "2021"
readme = "README.md"
Expand Down
9 changes: 6 additions & 3 deletions src/hash_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::wait_queue::{AsyncWait, DeriveAsyncWait};
use bucket::{DataBlock, EntryPtr, Locker, Reader, BUCKET_LEN, CACHE, OPTIMISTIC};
use bucket_array::BucketArray;
use std::borrow::Borrow;
use std::hash::{BuildHasher, Hash};
use std::hash::{BuildHasher, Hash, Hasher};
use std::pin::Pin;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
use std::sync::atomic::{fence, AtomicUsize};
Expand All @@ -19,13 +19,16 @@ where
H: BuildHasher,
{
/// Returns the hash value of the key.
#[allow(clippy::manual_hash_one)] // Stabilized in Rust 1.71.0.
#[inline]
fn hash<Q>(&self, key: &Q) -> u64
where
K: Borrow<Q>,
Q: Hash + ?Sized,
{
self.hasher().hash_one(key)
let mut hasher = self.hasher().build_hasher();
key.hash(&mut hasher);
hasher.finish()
}

/// Returns a reference to its [`BuildHasher`].
Expand Down Expand Up @@ -1135,7 +1138,7 @@ pub(super) struct LockedEntry<'h, K: Eq + Hash, V, const TYPE: char> {
pub(super) index: usize,
}

impl<'h, K: Eq + Hash, V, const TYPE: char> LockedEntry<'h, K, V, TYPE> {
impl<'h, K: Eq + Hash + 'h, V: 'h, const TYPE: char> LockedEntry<'h, K, V, TYPE> {
/// Gets the first occupied entry.
pub(super) async fn first_entry_async<H: BuildHasher, T: HashTable<K, V, H, TYPE>>(
hash_table: &'h T,
Expand Down

0 comments on commit 5b2a4be

Please sign in to comment.