In #518 the behavior with respect to lifetime elision for tracked functions is kind of inconsistent:
For the &dyn Db parameter, we always infer the elided lifetime to be 'db
For other random inputs, we basically disallow elision: if you use a '_, it will wind up in the value of an associated type, and give an error.
We'll also do one weird thing which is if you write fn foo<'db>(db: &dyn Db, x: Foo<'db>), I believe the db becomes &'db dyn Db.
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:
Introduce a 'db if it's not already there and replace all elided lifetimes with 'db.
Forbid elided lifetimes in the inputs unless there is exactly one (i.e., on the database). This is ~the current behavior, actually, except for the third bullet, which we should fix.
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.
In #518 the behavior with respect to lifetime elision for tracked functions is kind of inconsistent:
&dyn Db
parameter, we always infer the elided lifetime to be'db
'_
, it will wind up in the value of an associated type, and give an error.fn foo<'db>(db: &dyn Db, x: Foo<'db>)
, I believe thedb
becomes&'db dyn Db
.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 likeTrackedStruct<'db>
orInternedStruct<'db>
.The current setup seems weird but there are two different choices we could make:
'db
if it's not already there and replace all elided lifetimes with'db
.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.