Skip to content

Commit d355f11

Browse files
authored
Merge pull request #243 from cuviper/hashbrown-0.13
Upgrade to hashbrown 0.13 (MSRV 1.61)
2 parents aa4ee74 + 0589eb8 commit d355f11

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
include:
19-
- rust: 1.56.0 # MSRV
19+
- rust: 1.61.0 # MSRV
2020
features:
2121
- rust: stable
2222
features: serde
@@ -55,7 +55,7 @@ jobs:
5555
strategy:
5656
matrix:
5757
include:
58-
- rust: 1.56.0
58+
- rust: 1.61.0
5959
target: thumbv6m-none-eabi
6060
- rust: stable
6161
target: thumbv6m-none-eabi

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "Apache-2.0 OR MIT"
99
description = "A hash table with consistent order and fast iteration."
1010
keywords = ["hashmap", "no_std"]
1111
categories = ["data-structures", "no-std"]
12-
rust-version = "1.56"
12+
rust-version = "1.61"
1313

1414
[lib]
1515
bench = false
@@ -23,7 +23,7 @@ rayon = { version = "1.4.1", optional = true }
2323
rustc-rayon = { version = "0.4", optional = true }
2424

2525
[dependencies.hashbrown]
26-
version = "0.12"
26+
version = "0.13"
2727
default-features = false
2828
features = ["raw"]
2929

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![build status](https://github.com/bluss/indexmap/workflows/Continuous%20integration/badge.svg?branch=master)](https://github.com/bluss/indexmap/actions)
44
[![crates.io](https://img.shields.io/crates/v/indexmap.svg)](https://crates.io/crates/indexmap)
55
[![docs](https://docs.rs/indexmap/badge.svg)](https://docs.rs/indexmap)
6-
[![rustc](https://img.shields.io/badge/rust-1.56%2B-orange.svg)](https://img.shields.io/badge/rust-1.56%2B-orange.svg)
6+
[![rustc](https://img.shields.io/badge/rust-1.61%2B-orange.svg)](https://img.shields.io/badge/rust-1.61%2B-orange.svg)
77

88
A pure-Rust hash table which preserves (in a limited sense) insertion order.
99

RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- 2.0.0 (pending)
22

3+
- **MSRV**: Rust 1.61.0 or later is now required.
4+
35
- The `"std"` feature is no longer auto-detected. It is included in the
46
default feature set, or else can be enabled like any other Cargo feature.
57

@@ -15,6 +17,8 @@
1517
comparison traits like `Eq` only consider items in order, rather than hash
1618
lookups, and slices even implement `Hash`.
1719

20+
- The `hashbrown` dependency has been updated to version 0.13.
21+
1822
- 1.9.1
1923

2024
- The MSRV now allows Rust 1.56.0 as well. However, currently `hashbrown`

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
//!
5454
//! ### Rust Version
5555
//!
56-
//! This version of indexmap requires Rust 1.56 or later.
56+
//! This version of indexmap requires Rust 1.61 or later.
5757
//!
5858
//! The indexmap 2.x release series will use a carefully considered version
5959
//! upgrade policy, where in a later 2.x version, we will raise the minimum

src/map/core/raw.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(super) struct DebugIndices<'a>(pub &'a RawTable<usize>);
2626
impl fmt::Debug for DebugIndices<'_> {
2727
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2828
// SAFETY: we're not letting any of the buckets escape this function
29-
let indices = unsafe { self.0.iter().map(|raw_bucket| raw_bucket.read()) };
29+
let indices = unsafe { self.0.iter().map(|raw_bucket| *raw_bucket.as_ref()) };
3030
f.debug_list().entries(indices).finish()
3131
}
3232
}
@@ -38,10 +38,10 @@ impl<K, V> IndexMapCore<K, V> {
3838
unsafe {
3939
let offset = end - start;
4040
for bucket in self.indices.iter() {
41-
let i = bucket.read();
42-
if i >= end {
43-
bucket.write(i - offset);
44-
} else if i >= start {
41+
let i = bucket.as_mut();
42+
if *i >= end {
43+
*i -= offset;
44+
} else if *i >= start {
4545
self.indices.erase(bucket);
4646
}
4747
}
@@ -92,8 +92,8 @@ impl<K, V> IndexMapCore<K, V> {
9292
unsafe {
9393
let raw_bucket_a = self.find_index(a);
9494
let raw_bucket_b = self.find_index(b);
95-
raw_bucket_a.write(b);
96-
raw_bucket_b.write(a);
95+
*raw_bucket_a.as_mut() = b;
96+
*raw_bucket_b.as_mut() = a;
9797
}
9898
self.entries.swap(a, b);
9999
}
@@ -151,7 +151,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
151151
#[inline]
152152
pub fn index(&self) -> usize {
153153
// SAFETY: we have &mut map keep keeping the bucket stable
154-
unsafe { self.raw_bucket.read() }
154+
unsafe { *self.raw_bucket.as_ref() }
155155
}
156156

157157
/// Converts into a mutable reference to the entry's value in the map,

0 commit comments

Comments
 (0)