Skip to content

Commit b34c5a2

Browse files
incr.comp.: Make ConstEval dep-node anonymous.
1 parent 6bb0693 commit b34c5a2

File tree

2 files changed

+22
-31
lines changed

2 files changed

+22
-31
lines changed

src/librustc/dep_graph/dep_node.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ use hir::map::DefPathHash;
6666
use ich::Fingerprint;
6767
use ty::{TyCtxt, Instance, InstanceDef};
6868
use ty::fast_reject::SimplifiedType;
69-
use ty::subst::Substs;
7069
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
7170
use ich::StableHashingContext;
7271
use std::fmt;
@@ -104,6 +103,8 @@ macro_rules! define_dep_nodes {
104103
match *self {
105104
$(
106105
DepKind :: $variant => {
106+
$(return !anon_attr_to_bool!($anon);)*
107+
107108
// tuple args
108109
$({
109110
return <( $($tuple_arg,)* ) as DepNodeParams>
@@ -112,6 +113,7 @@ macro_rules! define_dep_nodes {
112113

113114
// struct args
114115
$({
116+
115117
return <( $($struct_arg_ty,)* ) as DepNodeParams>
116118
::CAN_RECONSTRUCT_QUERY_KEY;
117119
})*
@@ -445,17 +447,17 @@ define_dep_nodes!( <'tcx>
445447
[] TypeckBodiesKrate,
446448
[] TypeckTables(DefId),
447449
[] HasTypeckTables(DefId),
448-
[] ConstEval { def_id: DefId, substs: &'tcx Substs<'tcx> },
450+
[anon] ConstEval,
449451
[] SymbolName(DefId),
450452
[] InstanceSymbolName { instance: Instance<'tcx> },
451453
[] SpecializationGraph(DefId),
452454
[] ObjectSafety(DefId),
453455

454-
[anon] IsCopy(DefId),
455-
[anon] IsSized(DefId),
456-
[anon] IsFreeze(DefId),
457-
[anon] NeedsDrop(DefId),
458-
[anon] Layout(DefId),
456+
[anon] IsCopy,
457+
[anon] IsSized,
458+
[anon] IsFreeze,
459+
[anon] NeedsDrop,
460+
[anon] Layout,
459461

460462
// The set of impls for a given trait.
461463
[] TraitImpls(DefId),

src/librustc/ty/maps.rs

+13-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use dep_graph::{DepConstructor, DepNode, DepNodeIndex};
12-
use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
12+
use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
1313
use hir::def::Def;
1414
use hir;
1515
use middle::const_val;
@@ -1036,10 +1036,9 @@ fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
10361036
DepConstructor::TypeckBodiesKrate
10371037
}
10381038

1039-
fn const_eval_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
1039+
fn const_eval_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
10401040
-> DepConstructor<'tcx> {
1041-
let (def_id, substs) = key.value;
1042-
DepConstructor::ConstEval { def_id, substs }
1041+
DepConstructor::ConstEval
10431042
}
10441043

10451044
fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
@@ -1054,32 +1053,22 @@ fn relevant_trait_impls_for<'tcx>((def_id, t): (DefId, SimplifiedType)) -> DepCo
10541053
DepConstructor::RelevantTraitImpls(def_id, t)
10551054
}
10561055

1057-
fn is_copy_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1058-
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
1059-
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
1060-
DepConstructor::IsCopy(def_id)
1056+
fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1057+
DepConstructor::IsCopy
10611058
}
10621059

1063-
fn is_sized_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1064-
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
1065-
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
1066-
DepConstructor::IsSized(def_id)
1060+
fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1061+
DepConstructor::IsSized
10671062
}
10681063

1069-
fn is_freeze_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1070-
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
1071-
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
1072-
DepConstructor::IsFreeze(def_id)
1064+
fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1065+
DepConstructor::IsFreeze
10731066
}
10741067

1075-
fn needs_drop_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1076-
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
1077-
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
1078-
DepConstructor::NeedsDrop(def_id)
1068+
fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1069+
DepConstructor::NeedsDrop
10791070
}
10801071

1081-
fn layout_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1082-
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
1083-
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
1084-
DepConstructor::Layout(def_id)
1072+
fn layout_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
1073+
DepConstructor::Layout
10851074
}

0 commit comments

Comments
 (0)