Skip to content

incr.comp.: Turn translation item collection and CGU partitioning into a query. #44486

Closed
@michaelwoerister

Description

@michaelwoerister

Right now translation item collection and CGU partitioning are run as part of rustc_trans::base::trans_crate(). For better integration with red/green tracking this functionality should be moved into a pair of queries:

  • The first query does all of translation item collection and partitioning and returns (set of all trans-items, set of all partitions). It can have a query key of () as it only takes other queries as input.
  • The second query has query-key cgu_name: &str and returns the single CodegenUnit with that name. It just reads from the result of the first query. It's purpose is to provide a "firewall" so codegen units can be re-used if they don't change.

Doing this refactoring will involve moving TransItem and CodegenUnit to librustc, so they can be used in query results. One will also have to provide a HashStable implementation for the results of the two queries. The implementation for CodegenUnit should do something like CodegenUnit::compute_symbol_name_hash(). For translation items one could maybe just hash the symbol name.

cc @nikomatsakis @alexcrichton

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationC-cleanupCategory: PRs that clean code up or issues documenting cleanup.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