Skip to content

Commit 6d03fa7

Browse files
committed
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?
1 parent f89d509 commit 6d03fa7

File tree

1 file changed

+35
-41
lines changed

1 file changed

+35
-41
lines changed

compiler/rustc_middle/src/dep_graph/dep_node.rs

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -329,52 +329,46 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for HirId {
329329
}
330330
}
331331

332-
macro_rules! impl_for_typed_def_id {
333-
($Name:ident, $LocalName:ident) => {
334-
impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for $Name {
335-
#[inline(always)]
336-
fn fingerprint_style() -> FingerprintStyle {
337-
FingerprintStyle::DefPathHash
338-
}
332+
impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for ModDefId {
333+
#[inline(always)]
334+
fn fingerprint_style() -> FingerprintStyle {
335+
FingerprintStyle::DefPathHash
336+
}
339337

340-
#[inline(always)]
341-
fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint {
342-
self.to_def_id().to_fingerprint(tcx)
343-
}
338+
#[inline(always)]
339+
fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint {
340+
self.to_def_id().to_fingerprint(tcx)
341+
}
344342

345-
#[inline(always)]
346-
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
347-
self.to_def_id().to_debug_str(tcx)
348-
}
343+
#[inline(always)]
344+
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
345+
self.to_def_id().to_debug_str(tcx)
346+
}
349347

350-
#[inline(always)]
351-
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
352-
DefId::recover(tcx, dep_node).map($Name::new_unchecked)
353-
}
354-
}
348+
#[inline(always)]
349+
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
350+
DefId::recover(tcx, dep_node).map(ModDefId::new_unchecked)
351+
}
352+
}
355353

356-
impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for $LocalName {
357-
#[inline(always)]
358-
fn fingerprint_style() -> FingerprintStyle {
359-
FingerprintStyle::DefPathHash
360-
}
354+
impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for LocalModDefId {
355+
#[inline(always)]
356+
fn fingerprint_style() -> FingerprintStyle {
357+
FingerprintStyle::DefPathHash
358+
}
361359

362-
#[inline(always)]
363-
fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint {
364-
self.to_def_id().to_fingerprint(tcx)
365-
}
360+
#[inline(always)]
361+
fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint {
362+
self.to_def_id().to_fingerprint(tcx)
363+
}
366364

367-
#[inline(always)]
368-
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
369-
self.to_def_id().to_debug_str(tcx)
370-
}
365+
#[inline(always)]
366+
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
367+
self.to_def_id().to_debug_str(tcx)
368+
}
371369

372-
#[inline(always)]
373-
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
374-
LocalDefId::recover(tcx, dep_node).map($LocalName::new_unchecked)
375-
}
376-
}
377-
};
370+
#[inline(always)]
371+
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
372+
LocalDefId::recover(tcx, dep_node).map(LocalModDefId::new_unchecked)
373+
}
378374
}
379-
380-
impl_for_typed_def_id! { ModDefId, LocalModDefId }

0 commit comments

Comments
 (0)