Lifetime error with self-referential type (redb::WriteTransaction)

That's a &'db mut UserTransaction<'db>, which translates to "exclusively borrow the UseTransaction<'db> for the rest of it's validity ('db)". Once you do that, you can never use the UseTransaction<'db> again -- you can't call methods on it, you can't move it, and non-trivial destructors cannot be ran on it either.

You have a non-trivial destructor apparently, so that cannot compile.

Try fn compute_some_thing(&mut self).

Reproduction.

6 Likes