-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore Salsa DB for exploring Salsa further #11338
base: main
Are you sure you want to change the base?
Conversation
|
93dd0ac
to
bb974e2
Compare
bb974e2
to
3989cb8
Compare
CodSpeed Performance ReportMerging #11338 will not alter performanceComparing Summary
|
} | ||
|
||
#[salsa::tracked(jar=Jar)] | ||
pub struct ResolvedModule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexWaygood this is where I'm currently landing on a Salsa design for a module resolver. I think it would simplify a lot for you because you no longer need to think about invalidation, Salsa will take care of that for you. The only thing necessary for this to work is that you use db.file(path).exists()
to test if a file exists.
But check out resolve_module
, it's now almost empty!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for the ping. Yes, this indeed does make the code look a lot cleaner! It was making my head hurt a little bit to see all the cache-checking stuff right alongside the search-path semantics in resolve_module()
pub fn path_to_module(db: &dyn Db, path: &Path) -> Option<ResolvedModule> { | ||
let file = db.file(path.to_path_buf()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit weird that path_to_module
converts the path to a file
as the very first thing only so that file_to_module
then reads the path. However, for file_to_module
to be a salsa query, it can only accept an ingredient as an argument and file
is an ingredient but path
isn't.
a7d17b5
to
44bfbe2
Compare
…de as derived queries.
44bfbe2
to
4e2ec9f
Compare
No description provided.