Skip to content

Make traits_in_crate and impls_in_crate proper queries and use them #95092

Open
@cjgillot

Description

@cjgillot

We currently compute a list of all traits and all impls in a crate for metadata.
traits_in_crate is a query, and sorts all definitions by DefPathHash.
impls_in_crate is not a query, and sorts definitions by DefPathHash.

This PR suggests to:

  • shift the sorting of traits_in_crate from the query to metadata encoding;
  • use traits_in_crate for all analyses that iterate on traits;
  • make impls_in_crate a query, keeping the sorting outside of the query in metadata encoding;
  • use impls_in_crate for analyses that iterate on impls, like coherence.

The effect of the sorting on the definitions by DefPathHash is not obvious. The effect of sorting vs not sorting will need to investigated with respect to soundness of the crate_hash.

This issue may conflict with #94878, #95004 and #95082.

I am available on Zulip for further information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)E-help-wantedCall for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions