internal: remove input queries from #[query_group]#22639
Conversation
|
Left some stylistic questions in the code, mainly for future such PRs |
7fe164e to
3656520
Compare
|
Let me draft this while I investigate the test failures... |
While I have no idea why those ids would change as a result of this PR, the fact that the changes are all consistent seems like a good sign? |
DefDatabased::expand_proc_attr_macros out of the query groupDefDatabased::expand_proc_attr_macros out of the query group
|
Its because this change changes the salsa ingredient order which thus changes the page allocator and IDs of the allocation |
|
So.. it's fine? Should I just update the tests? |
|
Oh yea its fine and expected, meant to add that, so just update the tests |
3656520 to
5f7510d
Compare
| // TODO: should I create `AnalysisHost::{update_,}expand_proc_attr_macros` to clean this up? | ||
| // TODO: we don't use `raw_db` mutably until we go into the `if` -- is it a problem that I | ||
| // still get it mutably in an eager manner? I did this to avoid needing two separate calls, to | ||
| // `raw_database` and `raw_database_mut`. Or maybe I should just inline `raw_db`? |
There was a problem hiding this comment.
the rust-analyzer crate does depend on analysis crates, but we should avoid adding new such dependencies where possible. But I also don't think exposing the struct wholesale is a good idea; instead, export a fn set_expand_proc_attr_macros(value: bool).
There was a problem hiding this comment.
Added a setter and a getter, but called the former set_expand_proc_attr_macros_with_durability, to match base_db::set_all_crates_with_durability. The change is in a separate commit to simplify review, but I'd like to squash the commit before merging
There was a problem hiding this comment.
I think we should have only a setter, with no durability (that is, it sets the durability itself), that checks for equality with the previous value like here. hir is a high-level interface.
There was a problem hiding this comment.
Agree with the proposal to change the setter, but I don't think we can quite get rid of the getter, because it has one legitimate user:
There was a problem hiding this comment.
That's in hir-def, it can access the input struct directly.
| // TODO: `ide`'s Cargo.toml says that it should avoid depending on `hir-*` crates directly, | ||
| // and go through `hir` re-exports instead. `rust-analyzer` OTOH does seems to depend on `hir-*` | ||
| // after all. So, should I import `ExpandProcAttrMacros` through `hir` or `hir_def`? |
There was a problem hiding this comment.
Generally speaking we should at the very minimum have a re-export from hir instead then. Though even there the question then arises whether we shouldn't have a more "stable" interface for the given thing. We have not been very dilligent with keeping the separation maintained at the moment.
|
Also coming back to the IDs in tests changing, ideally we wouldn't print those in tests at all / would "normalize" them such that they are stable wrt to the test, not to the salsa databass state, but no one has gotten around to changing that (also unsure how easy that is) |
DefDatabased::expand_proc_attr_macros out of the query groupDefDatabase::expand_proc_attr_macros out of the query group
|
yea re-using one of these for both changes seems fine to me |
DefDatabase::expand_proc_attr_macros out of the query group#[query_group]
This required several non-trivial changes: - Rename the existing `ProcMacros::get` to `ProcMacros::get_for_crate` (feel free to suggest a better name), to avoid clashing with the new getter created by salsa. - Change `ProcMacroBuilder::build` to take `db` and `durability`, as it will need to build `ProcMacros` inside the `db`. Also rename it to `build_in`, to reflect the change in functionality. - `ProcMacros` is now stored in the database directly, instead of being wrapped in an Arc. This should be fine though, since its `by_crate` field is marked with `#[returns(ref)]`.
c0dfbc4 to
5834f7a
Compare
| "salsa_event(WillExecute { database_key: create_data_HelloWorldDatabase(Id(0)) })", | ||
| "salsa_event(WillCheckCancellation)", | ||
| "salsa_event(DidValidateMemoizedValue { database_key: create_data_HelloWorldDatabase(Id(0)) })", | ||
| "salsa_event(WillCheckCancellation)", | ||
| "salsa_event(WillExecute { database_key: invoke_length_query_shim(Id(800)) })", | ||
| "salsa_event(WillExecute { database_key: create_data_HelloWorldDatabase(Id(400)) })", | ||
| "salsa_event(WillCheckCancellation)", | ||
| "salsa_event(WillExecute { database_key: invoke_length_query_shim(Id(c00)) })", |
There was a problem hiding this comment.
are these changes to be expected?..
#[query_group]cc @Veykril