Skip to content

Commit

Permalink
compiles! don't use Merge trait in ColtNode
Browse files Browse the repository at this point in the history
  • Loading branch information
jhellerstein committed Oct 11, 2024
1 parent b4b6dca commit f848fe0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lattices/src/ght_lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ where
<GhtLeaf<Schema, SuffixSchema, Storage> as ColumnLazyTrieNode>::Force,
// Schema = Schema,
// SuffixSchema = SuffixSchema,
// Storage = Storage,
Storage = Storage,
>,
<Rest as ColtNode>::SuffixSchema: 'a,
GhtLeaf<Schema, SuffixSchema, Storage>: ColumnLazyTrieNode,
Expand Down Expand Up @@ -507,7 +507,7 @@ where
}

#[sealed]
impl<'a, Head, Node> ColtNode for var_type!(&'a mut GhtInner<Head, Node>)
impl<'a, Head, Node> ColtNode for (&'a mut GhtInner<Head, Node>, ())
where
GhtInner<Head, Node>: GeneralizedHashTrieNode,
Head: Clone + Eq + Hash,
Expand All @@ -527,19 +527,22 @@ where
#[sealed]
impl<'a, Head, Schema, ValType, Storage>
ColtNodeTail<GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>>
for var_type!(&'a mut GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>)
for (&'a mut GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>, ())
where
GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>: GeneralizedHashTrieNode<Head = Head>
+ GhtGet
+ crate::Merge<GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>>
+ GhtGet,
Self: ColtNode,
// GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>: GeneralizedHashTrieNode<Head = Head>
// + GhtGet
// + crate::Merge<GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>> // <---- this type bound made it only work for sets
// + GhtGet,
GhtLeaf<Schema, ValType, Storage>: GeneralizedHashTrieNode<Schema = Schema, Storage = Storage>,
Head: Clone + Eq + Hash,
Schema: Clone + Eq + Hash + VariadicExt,
Head: Clone, // + Eq + Hash,
Schema: Eq + Hash, // + Clone + Eq + Hash + VariadicExt,
Storage: VariadicCollection<Schema = Schema>,
{
fn merge(&mut self, inner_to_merge: GhtInner<Head, GhtLeaf<Schema, ValType, Storage>>) {

Check warning on line 542 in lattices/src/ght_lazy.rs

View workflow job for this annotation

GitHub Actions / Test Suite (WebAssembly) (pinned-nightly)

unused variable: `inner_to_merge`

Check warning on line 542 in lattices/src/ght_lazy.rs

View workflow job for this annotation

GitHub Actions / Test Suite (WebAssembly) (latest-nightly)

unused variable: `inner_to_merge`

Check warning on line 542 in lattices/src/ght_lazy.rs

View workflow job for this annotation

GitHub Actions / Docs (rustdoc)

unused variable: `inner_to_merge`
crate::Merge::merge(self.0, inner_to_merge);
// // we shouldn't use merge - that only works for sets
// crate::Merge::merge(self.0, inner_to_merge);
todo!()
}
}

Expand Down
2 changes: 2 additions & 0 deletions lattices/src/ght_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,8 @@ mod test {
// 348 | | // SuffixSchema = SuffixSchema,
// 349 | | >,
// | |_____^ unsatisfied trait bound introduced here
fn guard<T>(_: impl ColtNodeTail<T>) {}
// guard(forest.as_mut_var());
let result = ColtNode::get(forest.as_mut_var(), &3);
// println!("forest after get: {:?}", forest);
// println!("result.len() = {}", result.len());
Expand Down

0 comments on commit f848fe0

Please sign in to comment.