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.12k stars 150 forks source link

inconsistent behavior with respect to lifetime elision #519

Open nikomatsakis opened 2 months ago

nikomatsakis commented 2 months ago

In #518 the behavior with respect to lifetime elision for tracked functions is kind of inconsistent:

In reality, there is only one lifetime you can correctly use, which is 'db -- salsa tracked functions must not take references except for a case like TrackedStruct<'db> or InternedStruct<'db>.

The current setup seems weird but there are two different choices we could make:

The former seems more convenient: there's only one thing you could want, so let's do it.

The latter is more consistent with non-tracked-functions, and it means if you remove the #[salsa::tracked], your function keeps compiling.

I'm inclined towards the latter for now.