@@ -16,6 +16,7 @@ use middle::privacy::AccessLevels;
16
16
use mir;
17
17
use session:: CompileResult ;
18
18
use ty:: { self , CrateInherentImpls , Ty , TyCtxt } ;
19
+ use ty:: subst:: Substs ;
19
20
use util:: nodemap:: NodeSet ;
20
21
21
22
use rustc_data_structures:: indexed_vec:: IndexVec ;
@@ -74,6 +75,15 @@ impl Key for (CrateNum, DefId) {
74
75
}
75
76
}
76
77
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
+
77
87
trait Value < ' tcx > : Sized {
78
88
fn from_cycle_error < ' a > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> Self ;
79
89
}
@@ -217,6 +227,13 @@ impl<'tcx> QueryDescription for queries::reachable_set<'tcx> {
217
227
}
218
228
}
219
229
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
+
220
237
macro_rules! define_maps {
221
238
( <$tcx: tt>
222
239
$( $( #[ $attr: meta] ) *
@@ -446,16 +463,17 @@ define_maps! { <'tcx>
446
463
/// (Defined only for LOCAL_CRATE)
447
464
pub crate_inherent_impls_overlap_check: crate_inherent_impls_dep_node( CrateNum ) -> ( ) ,
448
465
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>,
452
470
453
471
/// Performs the privacy check and computes "access levels".
454
472
pub privacy_access_levels: PrivacyAccessLevels ( CrateNum ) -> Rc <AccessLevels >,
455
473
456
474
pub reachable_set: reachability_dep_node( CrateNum ) -> Rc <NodeSet >,
457
475
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>>
459
477
}
460
478
461
479
fn coherent_trait_dep_node ( ( _, def_id) : ( CrateNum , DefId ) ) -> DepNode < DefId > {
@@ -470,10 +488,14 @@ fn reachability_dep_node(_: CrateNum) -> DepNode<DefId> {
470
488
DepNode :: Reachability
471
489
}
472
490
473
- fn mir_shim ( instance : ty:: InstanceDef ) -> DepNode < DefId > {
491
+ fn mir_shim_dep_node ( instance : ty:: InstanceDef ) -> DepNode < DefId > {
474
492
instance. dep_node ( )
475
493
}
476
494
477
495
fn typeck_item_bodies_dep_node ( _: CrateNum ) -> DepNode < DefId > {
478
496
DepNode :: TypeckBodiesKrate
479
497
}
498
+
499
+ fn const_eval_dep_node ( ( def_id, _) : ( DefId , & Substs ) ) -> DepNode < DefId > {
500
+ DepNode :: ConstEval ( def_id)
501
+ }
0 commit comments