Skip to content

Clean up TyCtxt::needs_crate_hash usage and rename it to needs_hir_hash.#156092

Open
susitsm wants to merge 2 commits intorust-lang:mainfrom
susitsm:needs-hir-hash
Open

Clean up TyCtxt::needs_crate_hash usage and rename it to needs_hir_hash.#156092
susitsm wants to merge 2 commits intorust-lang:mainfrom
susitsm:needs-hir-hash

Conversation

@susitsm
Copy link
Copy Markdown

@susitsm susitsm commented May 2, 2026

While reviewing crate_hash query usage for #155871, the needs_crate_hash function turned out to be the cause of unnecessary calls to the query. The needs_crate_hash name is easy to mistake for the functionality of "needs the crate_hash query". This PR removes the usage of needs_crate_hash where it was not appropriate and renames the function to needs_hir_hash which better reflects its functionality.

susitsm added 2 commits May 2, 2026 17:53
…nabled, not when `needs_crate_hash` is true.

Exactly as the comment on the `crate_hash` field of `Linker` says, that
field is only used when incremental compilation is enabled.
`needs_crate_hash` returns true in some other cases too.
It's easy to confuse the functionality of `needs_crate_hash` with "is
the crate_hash query needed" right now. The function returns
whether we need to calculate the stable hash of various hir structs.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 2, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 2, 2026

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, types
  • compiler, types expanded to 73 candidates
  • Random selection from 21 candidates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants