]> git.lizzy.rs Git - rust.git/commitdiff
incr.comp.: Make ConstEval dep-node anonymous.
authorMichael Woerister <michaelwoerister@posteo>
Thu, 3 Aug 2017 12:45:01 +0000 (14:45 +0200)
committerMichael Woerister <michaelwoerister@posteo>
Thu, 3 Aug 2017 12:45:01 +0000 (14:45 +0200)
src/librustc/dep_graph/dep_node.rs
src/librustc/ty/maps.rs

index 800689f4638d29016cc7a921f9162042f9f3942d..c6f9cb2fceadd3f454121d8aecaa0fa56739cfcd 100644 (file)
@@ -66,7 +66,6 @@
 use ich::Fingerprint;
 use ty::{TyCtxt, Instance, InstanceDef};
 use ty::fast_reject::SimplifiedType;
-use ty::subst::Substs;
 use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
 use ich::StableHashingContext;
 use std::fmt;
@@ -104,6 +103,8 @@ pub fn can_reconstruct_query_key<$tcx>(&self) -> bool {
                 match *self {
                     $(
                         DepKind :: $variant => {
+                            $(return !anon_attr_to_bool!($anon);)*
+
                             // tuple args
                             $({
                                 return <( $($tuple_arg,)* ) as DepNodeParams>
@@ -112,6 +113,7 @@ pub fn can_reconstruct_query_key<$tcx>(&self) -> bool {
 
                             // struct args
                             $({
+
                                 return <( $($struct_arg_ty,)* ) as DepNodeParams>
                                     ::CAN_RECONSTRUCT_QUERY_KEY;
                             })*
@@ -445,17 +447,17 @@ pub fn to_dep_node(self, tcx: TyCtxt, kind: DepKind) -> DepNode {
     [] TypeckBodiesKrate,
     [] TypeckTables(DefId),
     [] HasTypeckTables(DefId),
-    [] ConstEval { def_id: DefId, substs: &'tcx Substs<'tcx> },
+    [anon] ConstEval,
     [] SymbolName(DefId),
     [] InstanceSymbolName { instance: Instance<'tcx> },
     [] SpecializationGraph(DefId),
     [] ObjectSafety(DefId),
 
-    [anon] IsCopy(DefId),
-    [anon] IsSized(DefId),
-    [anon] IsFreeze(DefId),
-    [anon] NeedsDrop(DefId),
-    [anon] Layout(DefId),
+    [anon] IsCopy,
+    [anon] IsSized,
+    [anon] IsFreeze,
+    [anon] NeedsDrop,
+    [anon] Layout,
 
     // The set of impls for a given trait.
     [] TraitImpls(DefId),
index d62d8f986c2392490c619452d518723d104a0081..a2e335c00b26ad22d475cd3b50bd651878b6905e 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use dep_graph::{DepConstructor, DepNode, DepNodeIndex};
-use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
+use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use hir::def::Def;
 use hir;
 use middle::const_val;
@@ -1036,10 +1036,9 @@ fn typeck_item_bodies_dep_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
     DepConstructor::TypeckBodiesKrate
 }
 
-fn const_eval_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
+fn const_eval_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)>)
                              -> DepConstructor<'tcx> {
-    let (def_id, substs) = key.value;
-    DepConstructor::ConstEval { def_id, substs }
+    DepConstructor::ConstEval
 }
 
 fn mir_keys<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
@@ -1054,32 +1053,22 @@ fn relevant_trait_impls_for<'tcx>((def_id, t): (DefId, SimplifiedType)) -> DepCo
     DepConstructor::RelevantTraitImpls(def_id, t)
 }
 
-fn is_copy_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
-    let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
-        .unwrap_or(DefId::local(CRATE_DEF_INDEX));
-    DepConstructor::IsCopy(def_id)
+fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
+    DepConstructor::IsCopy
 }
 
-fn is_sized_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
-    let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
-        .unwrap_or(DefId::local(CRATE_DEF_INDEX));
-    DepConstructor::IsSized(def_id)
+fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
+    DepConstructor::IsSized
 }
 
-fn is_freeze_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
-    let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
-        .unwrap_or(DefId::local(CRATE_DEF_INDEX));
-    DepConstructor::IsFreeze(def_id)
+fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
+    DepConstructor::IsFreeze
 }
 
-fn needs_drop_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
-    let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
-        .unwrap_or(DefId::local(CRATE_DEF_INDEX));
-    DepConstructor::NeedsDrop(def_id)
+fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
+    DepConstructor::NeedsDrop
 }
 
-fn layout_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
-    let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
-        .unwrap_or(DefId::local(CRATE_DEF_INDEX));
-    DepConstructor::Layout(def_id)
+fn layout_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepConstructor<'tcx> {
+    DepConstructor::Layout
 }