Skip to content

Commit caa3108

Browse files
committed
Release 0.6 with newer hashbrown and no mod raw
Fixes #21 so crate will work on Rust 1.82. We can't upgrade to `hashbrown 0.15` since it removes the `raw` table support. This is known upstream, and may just be something we have to live with: rust-lang/hashbrown#545 (comment) To align with `hashbrown`, and given this is a breaking change regardless, we remove the `raw` module just like `hashbrown` has. This should hopefully increase the chances that one day we can move to `hashbrown`'s new lower-level interface (`HashTable`) without a breaking change. This release also removes the `nightly` feature because it was mostly useless.
1 parent 80613a9 commit caa3108

File tree

12 files changed

+80
-342
lines changed

12 files changed

+80
-342
lines changed

.github/workflows/check.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ jobs:
104104
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
105105
# --feature-powerset runs for every combination of features
106106
- name: cargo hack
107-
run: cargo hack --feature-powerset --exclude-features nightly check
107+
run: cargo hack --feature-powerset check
108108
msrv:
109109
# check that we can build using the minimal rust version that is specified by this crate
110110
runs-on: ubuntu-latest
111111
# we use a matrix here just because env can't be used in job names
112112
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
113113
strategy:
114114
matrix:
115-
msrv: ["1.60.0"] # 2021 edition requires 1.56
115+
msrv: ["1.63.0"]
116116
name: ubuntu / ${{ matrix.msrv }}
117117
steps:
118118
- uses: actions/checkout@v4

.github/workflows/test.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ jobs:
3939
run: cargo generate-lockfile
4040
# https://twitter.com/jonhoo/status/1571290371124260865
4141
- name: cargo test --locked
42-
run: cargo test --locked --features serde,rayon,raw --all-targets
42+
run: cargo test --locked --all-features --all-targets
4343
# https://github.com/rust-lang/cargo/issues/6669
4444
- name: cargo test --doc
45-
run: cargo test --locked --features serde,rayon,raw --doc
45+
run: cargo test --locked --all-features --doc
4646
minimal:
4747
# This action chooses the oldest version of the dependencies permitted by Cargo.toml to ensure
4848
# that this crate is compatible with the minimal version that this crate and its dependencies
@@ -81,7 +81,7 @@ jobs:
8181
- name: cargo update -Zminimal-versions
8282
run: cargo +nightly update -Zminimal-versions
8383
- name: cargo test
84-
run: cargo test --locked --features serde,rayon,raw --all-targets
84+
run: cargo test --locked --all-features --all-targets
8585
os-check:
8686
# run cargo test on mac and windows
8787
runs-on: ${{ matrix.os }}
@@ -106,7 +106,7 @@ jobs:
106106
if: hashFiles('Cargo.lock') == ''
107107
run: cargo generate-lockfile
108108
- name: cargo test
109-
run: cargo test --locked --features serde,rayon,raw --all-targets
109+
run: cargo test --locked --all-features --all-targets
110110
coverage:
111111
# use llvm-cov to build and collect coverage and outputs in a format that
112112
# is compatible with codecov.io
@@ -130,13 +130,13 @@ jobs:
130130
#
131131
# for lots of more discussion
132132
runs-on: ubuntu-latest
133-
name: ubuntu / nightly / coverage
133+
name: ubuntu / stable / coverage
134134
steps:
135135
- uses: actions/checkout@v4
136136
with:
137137
submodules: true
138-
- name: Install nightly
139-
uses: dtolnay/rust-toolchain@nightly
138+
- name: Install stable
139+
uses: dtolnay/rust-toolchain@stable
140140
with:
141141
components: llvm-tools-preview
142142
- name: cargo install cargo-llvm-cov
@@ -145,7 +145,7 @@ jobs:
145145
if: hashFiles('Cargo.lock') == ''
146146
run: cargo generate-lockfile
147147
- name: cargo llvm-cov
148-
run: cargo llvm-cov --locked --features serde,rayon,raw --lcov --output-path lcov.info
148+
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
149149
- name: Record Rust version
150150
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
151151
- name: Upload to codecov.io

Cargo.toml

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "griddle"
3-
version = "0.5.2"
3+
version = "0.6.0"
44
authors = ["Jon Gjengset <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
license = "MIT OR Apache-2.0"
77

88
readme = "README.md"
@@ -14,9 +14,9 @@ categories = ["data-structures", "no-std"]
1414

1515
[dependencies]
1616
# For the default hasher
17-
ahash_ = { version = "0.7.0", default-features = false, optional = true, package = "ahash" }
17+
ahash_ = { version = "0.8.0", default-features = false, optional = true, package = "ahash" }
1818

19-
hashbrown = { version = "0.11.2", default-features = false, features = ["raw"] }
19+
hashbrown = { version = "0.14.0", default-features = false, features = ["raw"] }
2020

2121
# For external trait impls
2222
rayon_ = { version = "1.3.0", optional = true, package = "rayon" }
@@ -37,17 +37,14 @@ ahash-compile-time-rng = ["ahash_/compile-time-rng"]
3737
ahash = [ "ahash_", "hashbrown/ahash" ]
3838
serde = [ "serde_", "hashbrown/serde" ]
3939
rayon = [ "rayon_", "hashbrown/rayon" ]
40-
raw = []
4140

4241
# Enables usage of `#[inline]` on far more functions than by default in this
4342
# crate. This may lead to a performance increase but often comes at a compile
4443
# time cost.
4544
inline-more = [ "hashbrown/inline-more" ]
4645

47-
nightly = []
48-
4946
[package.metadata.docs.rs]
50-
features = ["rayon", "serde", "raw"]
47+
features = ["rayon", "serde"]
5148

5249
[[bench]]
5350
name = "vroom"

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,19 @@ work required to find the buckets that hold elements that must be moved.
8080
## Implementation
8181

8282
Griddle uses the
83-
[`hashbrown::raw`](https://docs.rs/hashbrown/0.8/hashbrown/raw/index.html)
83+
[`hashbrown::raw`](https://docs.rs/hashbrown/0.14/hashbrown/raw/index.html)
8484
API, which allows it to take advantage of all the awesome work that has
8585
gone into making `hashbrown` as fast as it is. The key different parts
86-
of griddle live in `src/raw/mod.rs`.
86+
of griddle live in `src/raw/mod.rs`. The `raw` API was [removed in
87+
`hashbrown` 0.15](https://github.com/rust-lang/hashbrown/issues/545), so
88+
Griddle is stuck on 0.14 for now.
8789

8890
Griddle aims to stick as closely to `hashbrown` as it can, both in terms
8991
of code and API. `src/map.rs` and `src/set.rs` are virtually identical
9092
to the equivalent files in `hashbrown` (I encourage you to diff them!),
9193
without only some (currently;
9294
[#4](https://github.com/jonhoo/griddle/issues/4)) unsupported API
93-
removed. Like `hashbrown`, griddle exposes a `raw` module, which lets
94-
you build your own map implementation on top of griddle's table variant.
95+
removed.
9596

9697
## Why "griddle"?
9798

codecov.yml

-18
This file was deleted.

lsan-suppressions.txt

Whitespace-only changes.

src/external_trait_impls/rayon/map.rs

-43
Original file line numberDiff line numberDiff line change
@@ -328,55 +328,12 @@ where
328328
#[cfg(test)]
329329
mod test_par_map {
330330
use alloc::vec::Vec;
331-
use core::hash::{Hash, Hasher};
332331
use core::sync::atomic::{AtomicUsize, Ordering};
333332

334333
use rayon_::prelude::*;
335334

336335
use crate::hash_map::HashMap;
337336

338-
struct Dropable<'a> {
339-
k: usize,
340-
counter: &'a AtomicUsize,
341-
}
342-
343-
impl Dropable<'_> {
344-
fn new(k: usize, counter: &AtomicUsize) -> Dropable<'_> {
345-
counter.fetch_add(1, Ordering::Relaxed);
346-
347-
Dropable { k, counter }
348-
}
349-
}
350-
351-
impl Drop for Dropable<'_> {
352-
fn drop(&mut self) {
353-
self.counter.fetch_sub(1, Ordering::Relaxed);
354-
}
355-
}
356-
357-
impl Clone for Dropable<'_> {
358-
fn clone(&self) -> Self {
359-
Dropable::new(self.k, self.counter)
360-
}
361-
}
362-
363-
impl Hash for Dropable<'_> {
364-
fn hash<H>(&self, state: &mut H)
365-
where
366-
H: Hasher,
367-
{
368-
self.k.hash(state)
369-
}
370-
}
371-
372-
impl PartialEq for Dropable<'_> {
373-
fn eq(&self, other: &Self) -> bool {
374-
self.k == other.k
375-
}
376-
}
377-
378-
impl Eq for Dropable<'_> {}
379-
380337
#[test]
381338
fn test_empty_iter() {
382339
let mut m: HashMap<isize, bool> = HashMap::new();

src/external_trait_impls/rayon/raw.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rayon_::iter::{
66
};
77

88
/// Parallel iterator which returns a raw pointer to every full bucket in the table.
9-
pub struct RawParIter<T> {
9+
pub(crate) struct RawParIter<T> {
1010
iter: hashbrown::raw::rayon::RawParIter<T>,
1111
leftovers: Option<hashbrown::raw::rayon::RawParIter<T>>,
1212
}
@@ -50,7 +50,7 @@ impl<T> ParallelIterator for RawParIter<T> {
5050
impl<T> RawTable<T> {
5151
/// Returns a parallel iterator over the elements in a `RawTable`.
5252
#[cfg_attr(feature = "inline-more", inline)]
53-
pub unsafe fn par_iter(&self) -> RawParIter<T> {
53+
pub(crate) unsafe fn par_iter(&self) -> RawParIter<T> {
5454
RawParIter {
5555
iter: self.main().par_iter(),
5656
leftovers: self.leftovers().map(|t| t.iter().into()),

src/lib.rs

-20
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,6 @@ extern crate std;
6666
#[cfg_attr(test, macro_use)]
6767
extern crate alloc;
6868

69-
#[cfg(feature = "raw")]
70-
/// Experimental and unsafe `RawTable` API. This module is only available if the
71-
/// `raw` feature is enabled.
72-
pub mod raw {
73-
#[path = "mod.rs"]
74-
mod inner;
75-
pub use inner::*;
76-
77-
#[cfg(feature = "rayon")]
78-
/// [rayon]-based parallel iterator types for raw hash tables.
79-
/// You will rarely need to interact with it directly unless you have need
80-
/// to name one of the iterator types.
81-
///
82-
/// [rayon]: https://docs.rs/rayon/1.0/rayon
83-
pub mod rayon {
84-
pub use crate::external_trait_impls::rayon::raw::*;
85-
}
86-
}
87-
#[cfg(not(feature = "raw"))]
88-
#[allow(dead_code)]
8969
mod raw;
9070

9171
mod external_trait_impls;

0 commit comments

Comments
 (0)