diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-02-02 19:51:37 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-02-04 08:34:11 +1100 |
| commit | 6d03fa75192d4915c3b79ea2e4909aacd4881ebf (patch) | |
| tree | 5ffd4407334b12eb36c1e19d1e5ed3b8df715063 | |
| parent | f89d509eb19d7f53cba39454a446b73d0ecc2fdb (diff) | |
| download | rust-6d03fa75192d4915c3b79ea2e4909aacd4881ebf.tar.gz rust-6d03fa75192d4915c3b79ea2e4909aacd4881ebf.zip | |
Remove `impl_for_typed_def_id` macro.
It has a single call site and removing it makes the code simpler. Perhaps there were more uses at some point in the past?
| -rw-r--r-- | compiler/rustc_middle/src/dep_graph/dep_node.rs | 76 |
1 files changed, 35 insertions, 41 deletions
diff --git a/compiler/rustc_middle/src/dep_graph/dep_node.rs b/compiler/rustc_middle/src/dep_graph/dep_node.rs index 14c72a61acd..7525aeb9227 100644 --- a/compiler/rustc_middle/src/dep_graph/dep_node.rs +++ b/compiler/rustc_middle/src/dep_graph/dep_node.rs @@ -329,52 +329,46 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for HirId { } } -macro_rules! impl_for_typed_def_id { - ($Name:ident, $LocalName:ident) => { - impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for $Name { - #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash - } +impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for ModDefId { + #[inline(always)] + fn fingerprint_style() -> FingerprintStyle { + FingerprintStyle::DefPathHash + } - #[inline(always)] - fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint { - self.to_def_id().to_fingerprint(tcx) - } + #[inline(always)] + fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint { + self.to_def_id().to_fingerprint(tcx) + } - #[inline(always)] - fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { - self.to_def_id().to_debug_str(tcx) - } + #[inline(always)] + fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { + self.to_def_id().to_debug_str(tcx) + } - #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> { - DefId::recover(tcx, dep_node).map($Name::new_unchecked) - } - } + #[inline(always)] + fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> { + DefId::recover(tcx, dep_node).map(ModDefId::new_unchecked) + } +} - impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for $LocalName { - #[inline(always)] - fn fingerprint_style() -> FingerprintStyle { - FingerprintStyle::DefPathHash - } +impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for LocalModDefId { + #[inline(always)] + fn fingerprint_style() -> FingerprintStyle { + FingerprintStyle::DefPathHash + } - #[inline(always)] - fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint { - self.to_def_id().to_fingerprint(tcx) - } + #[inline(always)] + fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint { + self.to_def_id().to_fingerprint(tcx) + } - #[inline(always)] - fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { - self.to_def_id().to_debug_str(tcx) - } + #[inline(always)] + fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { + self.to_def_id().to_debug_str(tcx) + } - #[inline(always)] - fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> { - LocalDefId::recover(tcx, dep_node).map($LocalName::new_unchecked) - } - } - }; + #[inline(always)] + fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> { + LocalDefId::recover(tcx, dep_node).map(LocalModDefId::new_unchecked) + } } - -impl_for_typed_def_id! { ModDefId, LocalModDefId } |
