mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-23 05:55:25 +00:00
incr.comp.: Make some DepNodes non-anonymous.
This commit is contained in:
parent
f0bbf4e1f2
commit
e1994bd27b
@ -65,7 +65,8 @@ use hir::map::DefPathHash;
|
||||
use hir::{HirId, ItemLocalId};
|
||||
|
||||
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 ich::StableHashingContext;
|
||||
use std::fmt;
|
||||
@ -480,17 +481,17 @@ define_dep_nodes!( <'tcx>
|
||||
[] TypeckBodiesKrate,
|
||||
[] TypeckTables(DefId),
|
||||
[] HasTypeckTables(DefId),
|
||||
[anon] ConstEval,
|
||||
[] ConstEval { param_env: ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)> },
|
||||
[] SymbolName(DefId),
|
||||
[] InstanceSymbolName { instance: Instance<'tcx> },
|
||||
[] SpecializationGraph(DefId),
|
||||
[] ObjectSafety(DefId),
|
||||
|
||||
[anon] IsCopy,
|
||||
[anon] IsSized,
|
||||
[anon] IsFreeze,
|
||||
[anon] NeedsDrop,
|
||||
[anon] Layout,
|
||||
[] IsCopy { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||
[] IsSized { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||
[] IsFreeze { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||
[] NeedsDrop { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||
[] Layout { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||
|
||||
// The set of impls for a given trait.
|
||||
[] TraitImpls(DefId),
|
||||
@ -524,10 +525,6 @@ define_dep_nodes!( <'tcx>
|
||||
// trait-select node.
|
||||
[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),
|
||||
[] DescribeDef(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,) {
|
||||
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
|
||||
|
||||
@ -800,4 +763,3 @@ impl_stable_hash_for!(struct ::dep_graph::WorkProductId {
|
||||
hash
|
||||
});
|
||||
|
||||
type DefIdList = Vec<DefId>;
|
||||
|
@ -377,9 +377,9 @@ fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||
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::ConstEval
|
||||
DepConstructor::ConstEval { param_env }
|
||||
}
|
||||
|
||||
fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||
@ -390,24 +390,24 @@ fn crate_variances<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
|
||||
DepConstructor::CrateVariances
|
||||
}
|
||||
|
||||
fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::IsCopy
|
||||
fn is_copy_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::IsCopy { param_env }
|
||||
}
|
||||
|
||||
fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::IsSized
|
||||
fn is_sized_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::IsSized { param_env }
|
||||
}
|
||||
|
||||
fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::IsFreeze
|
||||
fn is_freeze_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::IsFreeze { param_env }
|
||||
}
|
||||
|
||||
fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::NeedsDrop
|
||||
fn needs_drop_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::NeedsDrop { param_env }
|
||||
}
|
||||
|
||||
fn layout_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::Layout
|
||||
fn layout_dep_node<'tcx>(param_env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
|
||||
DepConstructor::Layout { param_env }
|
||||
}
|
||||
|
||||
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::Layout |
|
||||
DepKind::TraitSelect |
|
||||
DepKind::ProjectionCache |
|
||||
DepKind::ConstEval |
|
||||
|
||||
// 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)]
|
||||
pub struct Destructor {
|
||||
/// The def-id of the destructor method
|
||||
|
Loading…
Reference in New Issue
Block a user