From d1220fdedf030049a22a3ae430e15fda2a3f4477 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 27 Oct 2020 19:54:28 +0100 Subject: [PATCH] Simplify DepNodeParams. --- .../rustc_middle/src/dep_graph/dep_node.rs | 25 +++++++++++++++---- .../src/dep_graph/dep_node.rs | 6 ----- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs index 2a9d6b00db1..fa96b800928 100644 --- a/compiler/rustc_middle/src/dep_graph/dep_node.rs +++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs @@ -308,8 +308,23 @@ impl DepNodeExt for DepNode { } } +impl<'tcx> DepNodeParams> 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 { + Some(()) + } +} + impl<'tcx> DepNodeParams> for DefId { - #[inline] + #[inline(always)] fn can_reconstruct_query_key() -> bool { true } @@ -338,7 +353,7 @@ impl<'tcx> DepNodeParams> for DefId { } impl<'tcx> DepNodeParams> for LocalDefId { - #[inline] + #[inline(always)] fn can_reconstruct_query_key() -> bool { true } @@ -357,7 +372,7 @@ impl<'tcx> DepNodeParams> for LocalDefId { } impl<'tcx> DepNodeParams> for CrateNum { - #[inline] + #[inline(always)] fn can_reconstruct_query_key() -> bool { true } @@ -377,7 +392,7 @@ impl<'tcx> DepNodeParams> for CrateNum { } impl<'tcx> DepNodeParams> for (DefId, DefId) { - #[inline] + #[inline(always)] fn can_reconstruct_query_key() -> bool { false } @@ -402,7 +417,7 @@ impl<'tcx> DepNodeParams> for (DefId, DefId) { } impl<'tcx> DepNodeParams> for HirId { - #[inline] + #[inline(always)] fn can_reconstruct_query_key() -> bool { false } diff --git a/compiler/rustc_query_system/src/dep_graph/dep_node.rs b/compiler/rustc_query_system/src/dep_graph/dep_node.rs index ff52fdab19c..64aba870502 100644 --- a/compiler/rustc_query_system/src/dep_graph/dep_node.rs +++ b/compiler/rustc_query_system/src/dep_graph/dep_node.rs @@ -153,12 +153,6 @@ where } } -impl DepNodeParams 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