Skip to content
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

Turn parent_module_of_macro_def into a query #85999

Closed
cjgillot opened this issue Jun 4, 2021 · 1 comment · Fixed by #86694
Closed

Turn parent_module_of_macro_def into a query #85999

cjgillot opened this issue Jun 4, 2021 · 1 comment · Fixed by #86694
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cjgillot
Copy link
Contributor

cjgillot commented Jun 4, 2021

Those two methods contain information that is recorded by the resolver, before the incr. comp. infrastructure is set up.

For now, the maps are accessed as-is. They need to be made queries in order to ensure the correct tracking of their result.

In order to avoid having to compute the forcing query, a pre-requisite is to allow recovering an ExpnId from a Fingerprint.

@cjgillot cjgillot changed the title Turn expansion_that_defined and parent_module_of_macro_def into queries Turn parent_module_of_macro_def into a query Jun 4, 2021
@inquisitivecrystal
Copy link
Contributor

@rustbot label +A-macros +A-query-system +C-cleanup +T-compiler

@rustbot rustbot added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 5, 2021
@bors bors closed this as completed in d7901f3 Jul 6, 2021
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 17, 2021
Make expansions stable for incr. comp.

This PR aims to make expansions stable for incr. comp. by using the same architecture as definitions:
- the interned identifier `ExpnId` contains a `CrateNum` and a crate-local id;
- bidirectional maps `ExpnHash <-> ExpnId` are setup;
- incr. comp. on-disk cache saves and reconstructs expansions using their `ExpnHash`.

I tried to use as many `LocalExpnId` as I could in the resolver code, but I may have missed a few opportunities.

All this will allow to use an `ExpnId` as a query key, and to force this query without recomputing caller queries. For instance, this will be used to implement rust-lang#85999.

r? `@petrochenkov`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants