Skip to content

Intern FieldPath in salsa for O(1) clone#91

Merged
eikopf merged 3 commits intomainfrom
worktree-twinkly-growing-valiant
Mar 14, 2026
Merged

Intern FieldPath in salsa for O(1) clone#91
eikopf merged 3 commits intomainfrom
worktree-twinkly-growing-valiant

Conversation

@eikopf
Copy link
Copy Markdown
Owner

@eikopf eikopf commented Mar 14, 2026

Summary

  • Salsa-intern FieldPath for O(1) cloning and deduplication, replacing the plain Vec<PathSegment> that required O(n) clones on every Blame copy
  • Erase FieldName<'db> lifetime by storing salsa::Id in PathSegment, making the type 'static-compatible for salsa interning
  • Derive Copy on Blame since both fields (DeclId, FieldPath) are now salsa-interned

Supersedes #84, which used Rc wrapping instead.

Test plan

  • All 570 workspace tests pass (cargo test --workspace)

🤖 Generated with Claude Code

@eikopf eikopf force-pushed the worktree-twinkly-growing-valiant branch from 0f7ec92 to 12f8a1b Compare March 14, 2026 15:12
eikopf and others added 3 commits March 14, 2026 16:19
FieldPath is stored in every Blame value, making cheap clones important.
Previously it was a plain Vec<PathSegment> requiring O(n) clones. This
change salsa-interns FieldPath (making it Copy) by erasing the FieldName
lifetime through salsa::Id storage in PathSegment. Blame also becomes
Copy as both its fields are now salsa-interned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Blame and FieldPath are now Copy, so replace .clone() calls with
copies or field shorthand.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@eikopf eikopf force-pushed the worktree-twinkly-growing-valiant branch from 566b8cb to 610b8ca Compare March 14, 2026 15:19
@eikopf eikopf merged commit 30dd9cb into main Mar 14, 2026
4 checks passed
@eikopf eikopf deleted the worktree-twinkly-growing-valiant branch March 14, 2026 15:21
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