serai-dex / serai

Other
246 stars 45 forks source link

DbTxn must_use doesn't work #578

Open kayabaNerve opened 2 weeks ago

kayabaNerve commented 2 weeks ago

This is presumably somewhat a bug in Rust itself. I just need to make a MRE and evaluate it.

Identified due to #561.

kayabaNerve commented 2 weeks ago

https://github.com/rust-lang/rust/issues/102238#issuecomment-2211620177 for my comment on the relevant issue.

kayabaNerve commented 2 weeks ago
#[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.