@@ -16,6 +16,7 @@ use middle::privacy::AccessLevels;
1616use mir;
1717use session:: CompileResult ;
1818use ty:: { self , CrateInherentImpls , Ty , TyCtxt } ;
19+ use ty:: subst:: Substs ;
1920use util:: nodemap:: NodeSet ;
2021
2122use rustc_data_structures:: indexed_vec:: IndexVec ;
@@ -74,6 +75,15 @@ impl Key for (CrateNum, DefId) {
7475 }
7576}
7677
78+ impl < ' tcx > Key for ( DefId , & ' tcx Substs < ' tcx > ) {
79+ fn map_crate ( & self ) -> CrateNum {
80+ self . 0 . krate
81+ }
82+ fn default_span ( & self , tcx : TyCtxt ) -> Span {
83+ self . 0 . default_span ( tcx)
84+ }
85+ }
86+
7787trait Value < ' tcx > : Sized {
7888 fn from_cycle_error < ' a > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> Self ;
7989}
@@ -217,6 +227,13 @@ impl<'tcx> QueryDescription for queries::reachable_set<'tcx> {
217227 }
218228}
219229
230+ impl < ' tcx > QueryDescription for queries:: const_eval < ' tcx > {
231+ fn describe ( tcx : TyCtxt , ( def_id, _) : ( DefId , & ' tcx Substs < ' tcx > ) ) -> String {
232+ format ! ( "const-evaluating `{}`" ,
233+ tcx. item_path_str( def_id) )
234+ }
235+ }
236+
220237macro_rules! define_maps {
221238 ( <$tcx: tt>
222239 $( $( #[ $attr: meta] ) *
@@ -446,16 +463,17 @@ define_maps! { <'tcx>
446463 /// (Defined only for LOCAL_CRATE)
447464 pub crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node( CrateNum ) -> ( ) ,
448465
449- /// Results of evaluating monomorphic constants embedded in
450- /// other items, such as enum variant explicit discriminants.
451- pub monomorphic_const_eval: MonomorphicConstEval ( DefId ) -> const_val:: EvalResult <' tcx>,
466+ /// Results of evaluating const items or constants embedded in
467+ /// other items (such as enum variant explicit discriminants).
468+ pub const_eval: const_eval_dep_node( ( DefId , & ' tcx Substs <' tcx>) )
469+ -> const_val:: EvalResult <' tcx>,
452470
453471 /// Performs the privacy check and computes "access levels".
454472 pub privacy_access_levels: PrivacyAccessLevels ( CrateNum ) -> Rc <AccessLevels >,
455473
456474 pub reachable_set: reachability_dep_node( CrateNum ) -> Rc <NodeSet >,
457475
458- pub mir_shims: mir_shim ( ty:: InstanceDef <' tcx>) -> & ' tcx RefCell <mir:: Mir <' tcx>>
476+ pub mir_shims: mir_shim_dep_node ( ty:: InstanceDef <' tcx>) -> & ' tcx RefCell <mir:: Mir <' tcx>>
459477}
460478
461479fn coherent_trait_dep_node ( ( _, def_id) : ( CrateNum , DefId ) ) -> DepNode < DefId > {
@@ -470,10 +488,14 @@ fn reachability_dep_node(_: CrateNum) -> DepNode<DefId> {
470488 DepNode :: Reachability
471489}
472490
473- fn mir_shim ( instance : ty:: InstanceDef ) -> DepNode < DefId > {
491+ fn mir_shim_dep_node ( instance : ty:: InstanceDef ) -> DepNode < DefId > {
474492 instance. dep_node ( )
475493}
476494
477495fn typeck_item_bodies_dep_node ( _: CrateNum ) -> DepNode < DefId > {
478496 DepNode :: TypeckBodiesKrate
479497}
498+
499+ fn const_eval_dep_node ( ( def_id, _) : ( DefId , & Substs ) ) -> DepNode < DefId > {
500+ DepNode :: ConstEval ( def_id)
501+ }
0 commit comments