Open wdullaer opened 4 years ago
I believe this is because the impl of tuples for Transactional
use tuples of TransactionalTree. All the operations on the TransactionalTree
are UnabortableTransactionError
.
So I think this is on purpose in order to warn the users that a transaction on multiple trees cannot be aborted.
Bug reports must include:
The macro implementation of Transactional on tuples of trees is not generic over the error: https://github.com/spacejam/sled/blob/master/src/transaction.rs#L537
The implementation for Tree is.
This means that I can't return an error with the
abort
helper function when running a transaction over a tuple ofTree
s like I can for a transaction on an individualTree
.This compiles:
This does not compile:
Here's the output of rustc for that particular piece of code
I tried fixing this, by changing line 537 to
This would fix it, but it breaks type inference for closures that do not abort, which judging by https://github.com/spacejam/sled/issues/810#issuecomment-542082720 is undesirable. The example showing a transaction on tuple of trees gives a compiler errors that a type annotation is needed after this change is applied.
(I can't say I fully understand why type inference works for
Transactable<E>
on aTree
but not on a tuple ofTree
s)