Rename DepNodeKey::recover to try_recover_key
This commit is contained in:
parent
9eaedddb7f
commit
b015d5712a
3 changed files with 14 additions and 14 deletions
|
|
@ -213,7 +213,7 @@ pub trait DepNodeKey<'tcx>: fmt::Debug + Sized {
|
|||
/// `fingerprint_style()` is not `FingerprintStyle::Opaque`.
|
||||
/// It is always valid to return `None` here, in which case incremental
|
||||
/// compilation will treat the query as having changed instead of forcing it.
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>;
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>;
|
||||
}
|
||||
|
||||
// Blanket impl of `DepNodeKey`, which is specialized by other impls elsewhere.
|
||||
|
|
@ -244,7 +244,7 @@ where
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
default fn recover(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
|
||||
default fn try_recover_key(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl<'tcx> DepNodeKey<'tcx> for () {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
|
||||
fn try_recover_key(_: TyCtxt<'tcx>, _: &DepNode) -> Option<Self> {
|
||||
Some(())
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ impl<'tcx> DepNodeKey<'tcx> for DefId {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
dep_node.extract_def_id(tcx)
|
||||
}
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ impl<'tcx> DepNodeKey<'tcx> for LocalDefId {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
dep_node.extract_def_id(tcx).map(|id| id.expect_local())
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ impl<'tcx> DepNodeKey<'tcx> for OwnerId {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
dep_node.extract_def_id(tcx).map(|id| OwnerId { def_id: id.expect_local() })
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ impl<'tcx> DepNodeKey<'tcx> for CrateNum {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
dep_node.extract_def_id(tcx).map(|id| id.krate)
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ impl<'tcx> DepNodeKey<'tcx> for HirId {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
if tcx.key_fingerprint_style(dep_node.kind) == KeyFingerprintStyle::HirId {
|
||||
let (local_hash, local_id) = Fingerprint::from(dep_node.key_fingerprint).split();
|
||||
let def_path_hash = DefPathHash::new(tcx.stable_crate_id(LOCAL_CRATE), local_hash);
|
||||
|
|
@ -199,8 +199,8 @@ impl<'tcx> DepNodeKey<'tcx> for ModDefId {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
DefId::recover(tcx, dep_node).map(ModDefId::new_unchecked)
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
DefId::try_recover_key(tcx, dep_node).map(ModDefId::new_unchecked)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ impl<'tcx> DepNodeKey<'tcx> for LocalModDefId {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
LocalDefId::recover(tcx, dep_node).map(LocalModDefId::new_unchecked)
|
||||
fn try_recover_key(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
|
||||
LocalDefId::try_recover_key(tcx, dep_node).map(LocalModDefId::new_unchecked)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ pub(crate) fn try_load_from_on_disk_cache_inner<'tcx, C: QueryCache, const FLAGS
|
|||
) {
|
||||
debug_assert!(tcx.dep_graph.is_green(&dep_node));
|
||||
|
||||
let key = C::Key::recover(tcx, &dep_node).unwrap_or_else(|| {
|
||||
let key = C::Key::try_recover_key(tcx, &dep_node).unwrap_or_else(|| {
|
||||
panic!(
|
||||
"Failed to recover key for {dep_node:?} with key fingerprint {}",
|
||||
dep_node.key_fingerprint
|
||||
|
|
@ -465,7 +465,7 @@ pub(crate) fn force_from_dep_node_inner<'tcx, C: QueryCache, const FLAGS: QueryF
|
|||
"calling force_from_dep_node() on dep_kinds::codegen_unit"
|
||||
);
|
||||
|
||||
if let Some(key) = C::Key::recover(tcx, &dep_node) {
|
||||
if let Some(key) = C::Key::try_recover_key(tcx, &dep_node) {
|
||||
force_query(query, tcx, key, dep_node);
|
||||
true
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue