Skip to content

Commit 25f94c2

Browse files
author
Markus Westerlind
committed
Fix persistent tables
1 parent 528af9a commit 25f94c2

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/unify/backing_vec.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,17 @@ impl<K: UnifyKey> Default for Persistent<K> {
178178
}
179179

180180
#[cfg(feature = "persistent")]
181-
impl<K: UnifyKey> UnificationStore for Persistent<K> {
181+
impl<K: UnifyKey> UnificationStoreBase for Persistent<K> {
182182
type Key = K;
183183
type Value = K::Value;
184+
185+
fn len(&self) -> usize {
186+
self.values.len()
187+
}
188+
}
189+
190+
#[cfg(feature = "persistent")]
191+
impl<K: UnifyKey> UnificationStore for Persistent<K> {
184192
type Snapshot = Self;
185193

186194
#[inline]
@@ -211,10 +219,6 @@ impl<K: UnifyKey> UnificationStore for Persistent<K> {
211219
}
212220
}
213221

214-
fn len(&self) -> usize {
215-
self.values.len()
216-
}
217-
218222
#[inline]
219223
fn push(&mut self, value: VarValue<Self::Key>) {
220224
self.values.push(value);

src/unify/tests.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ fn big_array() {
9393
}
9494

9595
#[cfg(feature = "bench")]
96-
fn big_array_bench_generic<S: UnificationStore<Key = UnitKey, Value = ()>>(b: &mut Bencher) {
96+
fn big_array_bench_generic<S: Default + UnificationStore<Key = UnitKey, Value = ()>>(
97+
b: &mut Bencher,
98+
) {
9799
let mut ut: UnificationTable<S> = UnificationTable::new();
98100
let mut keys = Vec::new();
99101
const MAX: usize = 1 << 15;
@@ -128,7 +130,7 @@ fn big_array_bench_Persistent(b: &mut Bencher) {
128130
}
129131

130132
#[cfg(feature = "bench")]
131-
fn big_array_bench_in_snapshot_generic<S: UnificationStore<Key = UnitKey, Value = ()>>(
133+
fn big_array_bench_in_snapshot_generic<S: Default + UnificationStore<Key = UnitKey, Value = ()>>(
132134
b: &mut Bencher,
133135
) {
134136
let mut ut: UnificationTable<S> = UnificationTable::new();
@@ -169,7 +171,11 @@ fn big_array_bench_in_snapshot_Persistent(b: &mut Bencher) {
169171
}
170172

171173
#[cfg(feature = "bench")]
172-
fn big_array_bench_clone_generic<S: UnificationStore<Key = UnitKey, Value = ()>>(b: &mut Bencher) {
174+
fn big_array_bench_clone_generic<
175+
S: Default + Clone + UnificationStore<Key = UnitKey, Value = ()>,
176+
>(
177+
b: &mut Bencher,
178+
) {
173179
let mut ut: UnificationTable<S> = UnificationTable::new();
174180
let mut keys = Vec::new();
175181
const MAX: usize = 1 << 15;

0 commit comments

Comments
 (0)