In old code, we converted to a `&'db` when
creating a new tracked struct or interning,
but this value in fact persisted beyond the end
of `'db` (i.e., into the new revision).
We now refactor so that we create the `Foo<'db>`
from a `NonNull<T>` instead of a `&'db T`, and
then only create safe references when users
access fields.
This makes miri happy.
We now have AsId (always present)
and FromId/LookupId (sometimes present).
AsId is no longer part of the
salsa public interface.
Replace the ad-hoc `salsa_id` etc methods with
calls to `AsId::as_id`.
Previously tracked structs relied on an
interned ingredient to intern their keys.
But really it has more complex logic than we
need. Simpler to just remove it and duplicate
the basic concept.
The internal API is now based around providing
references to the `TrackedStructValue`.
Documenting the invariants led to one interesting
case, which is that we sometimes verify a tracked
struct as not having changed (and even create
`&`-ref to it!) but then re-execute the function
around it.
We now guarantee that, in this case, the data
does not change, even if it has leaked values.
This is required to ensure soundness.
Add a test case about it.
There are 3 call-sites to this function:
* One of them has already marked the outputs
* One of them has no outputs
* The third does need to mark the outputs
Right now, this doesn't change much except the
behavior in the event that `Eq` is not properly
implemented. In the future, it will enable
the use of references and slices and things.
In a previous PR we added the `include_all_fields`
parameter to `DebugWithDb` to allow it to
not create spurious dependencies.
This PR takes a different approach: we simply
ignore the dependencies created during debug
operations. This is risky as it can create
incorrect dependencies, but it is way more
convenient and seems like what users probably
want.
It also means that `DebugWithDb` has a simpler
signature that matches the `Debug` trait again,
which seems good to me.
First step towards the new tracked struct design.
SUBTLE: This is actually broken if the `#[id]`
fields have a broken hash. We'll fix that in the
next commit and add a test.