salsa-rs / salsa

A generic framework for on-demand, incrementalized computation. Inspired by adapton, glimmer, and rustc's query system.
https://salsa-rs.netlify.app/
Apache License 2.0
2.13k stars 152 forks source link

Unexpected panic: `assertion 'left= right failed: cannot change database mid-query` #536

Closed Chronostasys closed 3 months ago

Chronostasys commented 3 months ago

Hi, I recently updated my project's salsa to the newest version, and everything works well in debug mode. But as soon as I switched to the release build, a weird panic occurred: 5fdfa4e06b2fa8fd121d20b940e58245

You can see in the pic above that Rust is saying that two pointers with the address 0×14660cbb0 are not equal.

After some digging around, I found this issue: https://github.com/rust-lang/rust/issues/107975

And this: https://github.com/rust-lang/rust/issues/107975

I believe there's a mistake in the mid-query check, instead of checking the equivalent of two fat pointers, we shall check only the address.

https://github.com/salsa-rs/salsa/blob/e4ce917f6eda0d775ef654742a6f3cdc710f7d1a/src/local_state.rs#L87-L91