Skip to content

Commit b072a4a

Browse files
committed
fix issue introduced that affected dep_graph by implementing traits
1 parent 9f45b24 commit b072a4a

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

compiler/rustc_middle/src/dep_graph/dep_node.rs

+20-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use crate::ty::TyCtxt;
6262
use rustc_data_structures::fingerprint::Fingerprint;
6363
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX};
6464
use rustc_hir::definitions::DefPathHash;
65-
use rustc_hir::HirId;
65+
use rustc_hir::{HirId, HirOwner};
6666
use rustc_span::symbol::Symbol;
6767
use std::hash::Hash;
6868

@@ -426,6 +426,25 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for LocalDefId {
426426
}
427427
}
428428

429+
impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for HirOwner {
430+
#[inline(always)]
431+
fn can_reconstruct_query_key() -> bool {
432+
LocalDefId::can_reconstruct_query_key()
433+
}
434+
435+
fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint {
436+
self.def_id.to_fingerprint(tcx)
437+
}
438+
439+
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
440+
self.def_id.to_debug_str(tcx)
441+
}
442+
443+
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
444+
LocalDefId::recover(tcx, dep_node).map(|def_id| HirOwner { def_id })
445+
}
446+
}
447+
429448
impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for CrateNum {
430449
#[inline(always)]
431450
fn can_reconstruct_query_key() -> bool {

compiler/rustc_query_impl/src/profiling_support.rs

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use rustc_data_structures::fx::FxHashMap;
33
use rustc_data_structures::profiling::SelfProfiler;
44
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
55
use rustc_hir::definitions::DefPathData;
6+
use rustc_hir::HirOwner;
67
use rustc_middle::ty::{TyCtxt, WithOptConstParam};
78
use rustc_query_system::query::{QueryCache, QueryCacheStore};
89
use std::fmt::Debug;
@@ -165,6 +166,15 @@ impl SpecIntoSelfProfilingString for LocalDefId {
165166
}
166167
}
167168

169+
impl SpecIntoSelfProfilingString for HirOwner {
170+
fn spec_to_self_profile_string(
171+
&self,
172+
builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
173+
) -> StringId {
174+
self.def_id.spec_to_self_profile_string(builder)
175+
}
176+
}
177+
168178
impl<T: SpecIntoSelfProfilingString> SpecIntoSelfProfilingString for WithOptConstParam<T> {
169179
fn spec_to_self_profile_string(
170180
&self,

0 commit comments

Comments
 (0)