-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DbTxn must_use doesn't work #578
Comments
rust-lang/rust#102238 (comment) for my comment on the relevant issue. |
#[must_use]
trait X {}
fn y<Z: X>(z: Z) -> Z {
z
}
fn a<Z: X>(z: Z) {
y(z);
}
#[must_use]
struct A;
impl X for A {}
fn main() {
a(A);
} for the MRE. |
We can wrap the DbTxn generic in a struct which is must_use to workaround this. It's ugly but would be safe. |
must_use only requires use on a branch, not on all branches :/// |
The struct (and the correct application of must_use) would only guarantee the txn is bound, not moved out of scope. Opened an issue calling for a new clippy lint for an expanded interpretation of must_use: rust-lang/rust-clippy#13997 |
This is presumably somewhat a bug in Rust itself. I just need to make a MRE and evaluate it.
Identified due to #561.
The text was updated successfully, but these errors were encountered: