Remove DepKind::CrateMetadata and pre-allocation of DepNodes
Remove much of the special-case handling around crate metadata dependency tracking by replacing `DepKind::CrateMetadata` and the pre-allocation of corresponding `DepNodes` with on-demand invocation of the `crate_hash` query.
This commit is contained in:
@@ -214,17 +214,6 @@ pub mod dep_kind {
|
||||
try_load_from_on_disk_cache: |_, _| {},
|
||||
};
|
||||
|
||||
// Represents metadata from an extern crate.
|
||||
pub const CrateMetadata: DepKindStruct = DepKindStruct {
|
||||
has_params: true,
|
||||
is_anon: false,
|
||||
is_eval_always: true,
|
||||
|
||||
can_reconstruct_query_key: || true,
|
||||
force_from_dep_node: |_, dep_node| bug!("force_from_dep_node: encountered {:?}", dep_node),
|
||||
try_load_from_on_disk_cache: |_, _| {},
|
||||
};
|
||||
|
||||
pub const TraitSelect: DepKindStruct = DepKindStruct {
|
||||
has_params: false,
|
||||
is_anon: true,
|
||||
@@ -379,9 +368,6 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
|
||||
// We use this for most things when incr. comp. is turned off.
|
||||
[] Null,
|
||||
|
||||
// Represents metadata from an extern crate.
|
||||
[eval_always] CrateMetadata(CrateNum),
|
||||
|
||||
[anon] TraitSelect,
|
||||
|
||||
[] CompileCodegenUnit(Symbol),
|
||||
|
||||
@@ -115,20 +115,9 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
|
||||
// be removed. https://github.com/rust-lang/rust/issues/62649 is one such
|
||||
// bug that must be fixed before removing this.
|
||||
match dep_node.kind {
|
||||
DepKind::hir_owner | DepKind::hir_owner_nodes | DepKind::CrateMetadata => {
|
||||
DepKind::hir_owner | DepKind::hir_owner_nodes => {
|
||||
if let Some(def_id) = dep_node.extract_def_id(*self) {
|
||||
if def_id_corresponds_to_hir_dep_node(*self, def_id.expect_local()) {
|
||||
if dep_node.kind == DepKind::CrateMetadata {
|
||||
// The `DefPath` has corresponding node,
|
||||
// and that node should have been marked
|
||||
// either red or green in `data.colors`.
|
||||
bug!(
|
||||
"DepNode {:?} should have been \
|
||||
pre-marked as red or green but wasn't.",
|
||||
dep_node
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if !def_id_corresponds_to_hir_dep_node(*self, def_id.expect_local()) {
|
||||
// This `DefPath` does not have a
|
||||
// corresponding `DepNode` (e.g. a
|
||||
// struct field), and the ` DefPath`
|
||||
|
||||
Reference in New Issue
Block a user