incr.comp.: Make some DepNodes non-anonymous.
This commit is contained in:
parent
f0bbf4e1f2
commit
e1994bd27b
4 changed files with 36 additions and 59 deletions
|
@ -65,7 +65,8 @@ use hir::map::DefPathHash;
|
||||||
use hir::{HirId, ItemLocalId};
|
use hir::{HirId, ItemLocalId};
|
||||||
|
|
||||||
use ich::Fingerprint;
|
use ich::Fingerprint;
|
||||||
use ty::{TyCtxt, Instance, InstanceDef};
|
use ty::{TyCtxt, Instance, InstanceDef, ParamEnvAnd, Ty};
|
||||||
|
use ty::subst::Substs;
|
||||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||||
use ich::StableHashingContext;
|
use ich::StableHashingContext;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
@ -480,17 +481,17 @@ define_dep_nodes!( <'tcx>
|
||||||
[] TypeckBodiesKrate,
|
[] TypeckBodiesKrate,
|
||||||
[] TypeckTables(DefId),
|
[] TypeckTables(DefId),
|
||||||
[] HasTypeckTables(DefId),
|
[] HasTypeckTables(DefId),
|
||||||
[anon] ConstEval,
|
[] ConstEval { param_env: ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)> },
|
||||||
[] SymbolName(DefId),
|
[] SymbolName(DefId),
|
||||||
[] InstanceSymbolName { instance: Instance<'tcx> },
|
[] InstanceSymbolName { instance: Instance<'tcx> },
|
||||||
[] SpecializationGraph(DefId),
|
[] SpecializationGraph(DefId),
|
||||||
[] ObjectSafety(DefId),
|
[] ObjectSafety(DefId),
|
||||||
|
|
||||||
[anon] IsCopy,
|
[] IsCopy { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||||
[anon] IsSized,
|
[] IsSized { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||||
[anon] IsFreeze,
|
[] IsFreeze { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||||
[anon] NeedsDrop,
|
[] NeedsDrop { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||||
[anon] Layout,
|
[] Layout { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||||
|
|
||||||
// The set of impls for a given trait.
|
// The set of impls for a given trait.
|
||||||
[] TraitImpls(DefId),
|
[] TraitImpls(DefId),
|
||||||
|
@ -524,10 +525,6 @@ define_dep_nodes!( <'tcx>
|
||||||
// trait-select node.
|
// trait-select node.
|
||||||
[anon] TraitSelect,
|
[anon] TraitSelect,
|
||||||
|
|
||||||
// For proj. cache, we just keep a list of all def-ids, since it is
|
|
||||||
// not a hotspot.
|
|
||||||
[] ProjectionCache { def_ids: DefIdList },
|
|
||||||
|
|
||||||
[] ParamEnv(DefId),
|
[] ParamEnv(DefId),
|
||||||
[] DescribeDef(DefId),
|
[] DescribeDef(DefId),
|
||||||
[] DefSpan(DefId),
|
[] DefSpan(DefId),
|
||||||
|
@ -708,40 +705,6 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefIdList,) {
|
|
||||||
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
|
|
||||||
|
|
||||||
// We actually would not need to specialize the implementation of this
|
|
||||||
// method but it's faster to combine the hashes than to instantiate a full
|
|
||||||
// hashing context and stable-hashing state.
|
|
||||||
fn to_fingerprint(&self, tcx: TyCtxt) -> Fingerprint {
|
|
||||||
let mut fingerprint = Fingerprint::zero();
|
|
||||||
|
|
||||||
for &def_id in self.0.iter() {
|
|
||||||
let def_path_hash = tcx.def_path_hash(def_id);
|
|
||||||
fingerprint = fingerprint.combine(def_path_hash.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
fingerprint
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
|
|
||||||
use std::fmt::Write;
|
|
||||||
|
|
||||||
let mut s = String::new();
|
|
||||||
write!(&mut s, "[").unwrap();
|
|
||||||
|
|
||||||
for &def_id in self.0.iter() {
|
|
||||||
write!(&mut s, "{}", tcx.def_path(def_id).to_string(tcx)).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
write!(&mut s, "]").unwrap();
|
|
||||||
|
|
||||||
s
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (HirId,) {
|
impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (HirId,) {
|
||||||
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
|
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
|
||||||
|
|
||||||
|
@ -800,4 +763,3 @@ impl_stable_hash_for!(struct ::dep_graph::WorkProductId {
|
||||||
hash
|
hash
|
||||||
});
|
});
|
||||||
|
|
||||||
type DefIdList = Vec<DefId>;
|
|
||||||
|
|
|
@ -377,9 +377,9 @@ fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::TypeckBodiesKrate
|
DepConstructor::TypeckBodiesKrate
|
||||||
}
|
}
|
||||||
|
|
||||||
fn const_eval_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
|
fn const_eval_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
|
||||||
-> DepConstructor<'tcx> {
|
-> DepConstructor<'tcx> {
|
||||||
DepConstructor::ConstEval
|
DepConstructor::ConstEval { param_env }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||||
|
@ -390,24 +390,24 @@ fn crate_variances<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::CrateVariances
|
DepConstructor::CrateVariances
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
fn is_copy_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::IsCopy
|
DepConstructor::IsCopy { param_env }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
fn is_sized_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::IsSized
|
DepConstructor::IsSized { param_env }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
fn is_freeze_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::IsFreeze
|
DepConstructor::IsFreeze { param_env }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
fn needs_drop_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::NeedsDrop
|
DepConstructor::NeedsDrop { param_env }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
fn layout_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||||
DepConstructor::Layout
|
DepConstructor::Layout { param_env }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lint_levels_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
fn lint_levels_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||||
|
|
|
@ -672,7 +672,6 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
|
||||||
DepKind::NeedsDrop |
|
DepKind::NeedsDrop |
|
||||||
DepKind::Layout |
|
DepKind::Layout |
|
||||||
DepKind::TraitSelect |
|
DepKind::TraitSelect |
|
||||||
DepKind::ProjectionCache |
|
|
||||||
DepKind::ConstEval |
|
DepKind::ConstEval |
|
||||||
|
|
||||||
// We don't have enough information to reconstruct the query key of
|
// We don't have enough information to reconstruct the query key of
|
||||||
|
|
|
@ -1253,6 +1253,22 @@ impl<'tcx, T> ParamEnvAnd<'tcx, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'gcx, T> HashStable<StableHashingContext<'gcx>> for ParamEnvAnd<'gcx, T>
|
||||||
|
where T: HashStable<StableHashingContext<'gcx>>
|
||||||
|
{
|
||||||
|
fn hash_stable<W: StableHasherResult>(&self,
|
||||||
|
hcx: &mut StableHashingContext<'gcx>,
|
||||||
|
hasher: &mut StableHasher<W>) {
|
||||||
|
let ParamEnvAnd {
|
||||||
|
ref param_env,
|
||||||
|
ref value
|
||||||
|
} = *self;
|
||||||
|
|
||||||
|
param_env.hash_stable(hcx, hasher);
|
||||||
|
value.hash_stable(hcx, hasher);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct Destructor {
|
pub struct Destructor {
|
||||||
/// The def-id of the destructor method
|
/// The def-id of the destructor method
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue