Skip to content

Clarify cross-crate dependency story #32015

Closed
@nikomatsakis

Description

@nikomatsakis

We're currently doing some wrong-ish things with respect to dep-graph tracking across crate boundaries. I think what I want to do is this:

  • Create a DepNode::MetaData(DefId) variant that plays a role like Hir
    • it basically represents the metadata for some item
  • Whenever we load from metadata for item X, we'll generate a read on MetaData(X)
  • In the metadata, we'll include a hash for each item, either:
    • hashing the saved contents of the item
    • or hashing all the base input nodes that are deps of the things serialized into
    • basically some hash we can use to tell if the metadata for an item changed in some way
  • When we save the dep-graph, we'll save the hash out of the crate metadata
  • When we load, we'll reload the hash out of the current crate metadata and compare

For inlined items, I hope we will transition to MIR and not need to inline sooner or later, but in the meantime, I think we can basically translate reads to Hir(X) where X is an inlined def-id to MetaData(Y) where Y is the original def-id -- we may also just be able to ignore accesses to inlined def-ids, since we'll presumably add an appropriate edge from some other source.

Metadata

Metadata

Assignees

Labels

A-incr-compArea: Incremental compilationT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions