Skip to content

Commit

Permalink
Simplify DepNodeParams.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jan 8, 2021
1 parent 79a5762 commit d1220fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
25 changes: 20 additions & 5 deletions compiler/rustc_middle/src/dep_graph/dep_node.rs
Expand Up @@ -308,8 +308,23 @@ impl DepNodeExt for DepNode {
}
}

impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for () {
#[inline(always)]
fn can_reconstruct_query_key() -> bool {
true
}

fn to_fingerprint(&self, _: TyCtxt<'tcx>) -> Fingerprint {
Fingerprint::ZERO
}

fn recover(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
Some(())
}
}

impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for DefId {
#[inline]
#[inline(always)]
fn can_reconstruct_query_key() -> bool {
true
}
Expand Down Expand Up @@ -338,7 +353,7 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for DefId {
}

impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for LocalDefId {
#[inline]
#[inline(always)]
fn can_reconstruct_query_key() -> bool {
true
}
Expand All @@ -357,7 +372,7 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for LocalDefId {
}

impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for CrateNum {
#[inline]
#[inline(always)]
fn can_reconstruct_query_key() -> bool {
true
}
Expand All @@ -377,7 +392,7 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for CrateNum {
}

impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for (DefId, DefId) {
#[inline]
#[inline(always)]
fn can_reconstruct_query_key() -> bool {
false
}
Expand All @@ -402,7 +417,7 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for (DefId, DefId) {
}

impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for HirId {
#[inline]
#[inline(always)]
fn can_reconstruct_query_key() -> bool {
false
}
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_query_system/src/dep_graph/dep_node.rs
Expand Up @@ -153,12 +153,6 @@ where
}
}

impl<Ctxt: DepContext> DepNodeParams<Ctxt> for () {
fn to_fingerprint(&self, _: Ctxt) -> Fingerprint {
Fingerprint::ZERO
}
}

/// A "work product" corresponds to a `.o` (or other) file that we
/// save in between runs. These IDs do not have a `DefId` but rather
/// some independent path or string that persists between runs without
Expand Down

0 comments on commit d1220fd

Please sign in to comment.