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

Make extern_mod_stmt_cnum into a regular function #83128

Closed

Conversation

Aaron1011
Copy link
Member

cc #83126

It's very short, so there's no need for it to go through the query
system.

cc rust-lang#83126

It's very short, so there's no need for it to go through the query
system.
@rust-highfive
Copy link
Collaborator

r? @lcnr

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 14, 2021
@Mark-Simulacrum
Copy link
Member

@bors r+ rollup=never (may be perf sensitive)

@bors
Copy link
Contributor

bors commented Mar 14, 2021

📌 Commit 0e9be63 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 14, 2021
@lcnr
Copy link
Contributor

lcnr commented Mar 14, 2021

do we clear the query cache if the extern_crate_map changes between compilation sessions?

@Mark-Simulacrum
Copy link
Member

I don't immediately see how it'd be different inside the query (i.e., why that would not lead to just as many problems as with this impl) -- but happy to r- this for now if you think that's warranted

@lcnr
Copy link
Contributor

lcnr commented Mar 14, 2021

no, I also don't see how having a query helps here, so this PR seems good.

The existence of this query just feels kind of weird to me, maybe it was intended to improve incremental reuse in case extern_crate_map changes? But that wasn't actually the case afaict

@Aaron1011
Copy link
Member Author

I think the important thing is that a CrateId doesn't actually store any information by itself. A query can only produce it as part of a result (which would lead to the same ICE if the StableCrateId changed), or call a query using it as an input (which will cause it to get re-run if the crate changes).

@michaelwoerister
Copy link
Member

Are you all sure this is the right fix? Making something not be a query will certainly avoid triggering errors emitted by the query system's sanity checking -- but it might just turn this into a silent error. This not being a query will mean there's no dependency tracking for it.

@michaelwoerister
Copy link
Member

@bors r-

Sorry for barging in here, but this feels kind of fishy to me. @Aaron1011's previous suggestion of turning this into an eval-always query seems like the safer option to me. I'll take a closer look right now.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 15, 2021
@michaelwoerister
Copy link
Member

Yes, I'm confident now that this should be an eval_always query. Like all other queries that directly read pre-populated data from a tcx field, this is an outside input into the query system (like module_exports, in_scope_traits_map, and crate_name for example). Turning this into a regular method will mean that we don't do any dependency tracking for it.

The fact that this has not been an eval_always query is the actual bug. Since the query just reads some data from the tcx, it will never have any dependencies. When try_mark_green tries to mark it green, it will not find any red dependencies, so it will assume that nothing has changed without ever fingerprinting the new value.

So, to sum up: just make the query eval_always and the bug should be fixed.

@Aaron1011
Copy link
Member Author

Closing in favor of #83153

@Aaron1011 Aaron1011 closed this Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants