-
Notifications
You must be signed in to change notification settings - Fork 1.7k
internal: Make HirFileId
, EditionedFileId
and macro files Salsa struct
#19617
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
Conversation
c75f6d8
to
018402c
Compare
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Supertype)] | ||
pub enum HirFileId { | ||
FileId(EditionedFileId), | ||
MacroFile(MacroCallId), | ||
} |
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.
Note that it would be nicei f we could shrink this to 4 bytes again (as was done with the bit packing before). Iirc back when I implemented that it saved ~10mb. Not relevant to this PR for now though.
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.
We can do this if we store it in places as salsa::Id
(or some newtype wrapper). Methods can still take HirFileId
.
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.
Yes, I believe Niko's initial supertype proposal wouldvebeen something like that, where instead of it being a derive it was an attribute that collapsed the variants into an erased wrapper. I wonder if we could implement that as a separate thing to the derive as well. I do like the derive in most cases, given it doesn't require you to extract the active variant manually.
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.
Bit of a shame to see the distinction between macro call and macro file disappear but I imagine its annoying to get that to work with salsa nicely
018402c
to
593aa72
Compare
And make more queries non-interned. Also flip the default for queries, now the default is to not intern and to intern a query you need to say `invoke_interned`.
593aa72
to
c58ddaf
Compare
And make more queries non-interned.
Also flip the default for queries, now the default is to not intern and to intern a query you need to say
invoke_interned
.This saves 161mb on
analysis-stats .
.This is a big PR, but most of it is tedious replacements: the interesting changes are in
span
,base-db
andhir-expand/src/lib.rs
. Oh, andquery-group-macro
. The other files could use a skim review.