Skip to content

Derive Equality on the semantic index after all#1218

Open
lionel- wants to merge 2 commits into
mainfrom
oak/salsa-1b-equality
Open

Derive Equality on the semantic index after all#1218
lionel- wants to merge 2 commits into
mainfrom
oak/salsa-1b-equality

Conversation

@lionel-
Copy link
Copy Markdown
Contributor

@lionel- lionel- commented May 14, 2026

@DavisVaughan I thought we could use no_eq instead of the Eq/PartialEq derivation, but that's not the case. You still need either Eq, or derive/implement salsa::Update for updating the value in the Salsa storage. The latter also does deep comparisons.

I think Eq/PartialEq is better for oak_semantic because it feels useful to keep it completely independent of salsa.

One thing I've learned from ty is that they wrap symbol tables and use-def maps in Arc so that the comparisons are cheap. We now do the same, hopefully that addresses your concern about performance.

Also note that ty uses a no_eq attribute on their AST pointer in Definition. This needs Definition to be #[salsa::tracked] (the attribute only applies inside salsa-managed structs) and an Update derive. In our case we don't need all this complexity since our AST pointer type is very cheap to compare (a kind and a range).

lionel- added 2 commits May 14, 2026 11:46
Allows Salsa comparisons without depending on it (as Update would)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant