8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- use dep_graph:: { DepConstructor , DepNode , DepTrackingMapConfig } ;
11
+ use dep_graph:: { DepConstructor , DepNode } ;
12
12
use hir:: def_id:: { CrateNum , CRATE_DEF_INDEX , DefId , LOCAL_CRATE } ;
13
13
use hir:: def:: Def ;
14
14
use hir;
@@ -261,11 +261,16 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
261
261
}
262
262
}
263
263
264
- trait QueryDescription : DepTrackingMapConfig {
264
+ pub trait QueryConfig {
265
+ type Key : Eq + Hash + Clone ;
266
+ type Value ;
267
+ }
268
+
269
+ trait QueryDescription : QueryConfig {
265
270
fn describe ( tcx : TyCtxt , key : Self :: Key ) -> String ;
266
271
}
267
272
268
- impl < M : DepTrackingMapConfig < Key =DefId > > QueryDescription for M {
273
+ impl < M : QueryConfig < Key =DefId > > QueryDescription for M {
269
274
default fn describe ( tcx : TyCtxt , def_id : DefId ) -> String {
270
275
format ! ( "processing `{}`" , tcx. item_path_str( def_id) )
271
276
}
@@ -550,18 +555,19 @@ macro_rules! define_maps {
550
555
} ) *
551
556
}
552
557
553
- $( impl <$tcx> DepTrackingMapConfig for queries:: $name<$tcx> {
558
+ $( impl <$tcx> QueryConfig for queries:: $name<$tcx> {
554
559
type Key = $K;
555
560
type Value = $V;
561
+ }
556
562
563
+ impl <' a, $tcx, ' lcx> queries:: $name<$tcx> {
557
564
#[ allow( unused) ]
558
- fn to_dep_node( tcx: TyCtxt , key: & $K) -> DepNode {
565
+ fn to_dep_node( tcx: TyCtxt < ' a , $tcx , ' lcx> , key: & $K) -> DepNode {
559
566
use dep_graph:: DepConstructor :: * ;
560
567
561
568
DepNode :: new( tcx, $node( * key) )
562
569
}
563
- }
564
- impl <' a, $tcx, ' lcx> queries:: $name<$tcx> {
570
+
565
571
fn try_get_with<F , R >( tcx: TyCtxt <' a, $tcx, ' lcx>,
566
572
mut span: Span ,
567
573
key: $K,
@@ -861,19 +867,19 @@ define_maps! { <'tcx>
861
867
/// Maps DefId's that have an associated Mir to the result
862
868
/// of the MIR qualify_consts pass. The actual meaning of
863
869
/// the value isn't known except to the pass itself.
864
- [ ] mir_const_qualif: Mir ( DefId ) -> u8 ,
870
+ [ ] mir_const_qualif: MirConstQualif ( DefId ) -> u8 ,
865
871
866
872
/// Fetch the MIR for a given def-id up till the point where it is
867
873
/// ready for const evaluation.
868
874
///
869
875
/// See the README for the `mir` module for details.
870
- [ ] mir_const: Mir ( DefId ) -> & ' tcx Steal <mir:: Mir <' tcx>>,
876
+ [ ] mir_const: MirConst ( DefId ) -> & ' tcx Steal <mir:: Mir <' tcx>>,
871
877
872
- [ ] mir_validated: Mir ( DefId ) -> & ' tcx Steal <mir:: Mir <' tcx>>,
878
+ [ ] mir_validated: MirValidated ( DefId ) -> & ' tcx Steal <mir:: Mir <' tcx>>,
873
879
874
880
/// MIR after our optimization passes have run. This is MIR that is ready
875
881
/// for trans. This is also the only query that can fetch non-local MIR, at present.
876
- [ ] optimized_mir: Mir ( DefId ) -> & ' tcx mir:: Mir <' tcx>,
882
+ [ ] optimized_mir: MirOptimized ( DefId ) -> & ' tcx mir:: Mir <' tcx>,
877
883
878
884
/// Type of each closure. The def ID is the ID of the
879
885
/// expression defining the closure.
@@ -890,7 +896,7 @@ define_maps! { <'tcx>
890
896
891
897
[ ] typeck_tables_of: TypeckTables ( DefId ) -> & ' tcx ty:: TypeckTables <' tcx>,
892
898
893
- [ ] has_typeck_tables: TypeckTables ( DefId ) -> bool ,
899
+ [ ] has_typeck_tables: HasTypeckTables ( DefId ) -> bool ,
894
900
895
901
[ ] coherent_trait: coherent_trait_dep_node( ( CrateNum , DefId ) ) -> ( ) ,
896
902
@@ -972,80 +978,80 @@ define_maps! { <'tcx>
972
978
[ ] extern_crate: ExternCrate ( DefId ) -> Rc <Option <ExternCrate >>,
973
979
}
974
980
975
- fn type_param_predicates ( ( item_id, param_id) : ( DefId , DefId ) ) -> DepConstructor {
981
+ fn type_param_predicates < ' tcx > ( ( item_id, param_id) : ( DefId , DefId ) ) -> DepConstructor < ' tcx > {
976
982
DepConstructor :: TypeParamPredicates {
977
983
item_id,
978
984
param_id
979
985
}
980
986
}
981
987
982
- fn coherent_trait_dep_node ( ( _, def_id) : ( CrateNum , DefId ) ) -> DepConstructor {
988
+ fn coherent_trait_dep_node < ' tcx > ( ( _, def_id) : ( CrateNum , DefId ) ) -> DepConstructor < ' tcx > {
983
989
DepConstructor :: CoherenceCheckTrait ( def_id)
984
990
}
985
991
986
- fn crate_inherent_impls_dep_node ( _: CrateNum ) -> DepConstructor {
992
+ fn crate_inherent_impls_dep_node < ' tcx > ( _: CrateNum ) -> DepConstructor < ' tcx > {
987
993
DepConstructor :: Coherence
988
994
}
989
995
990
- fn reachability_dep_node ( _: CrateNum ) -> DepConstructor {
996
+ fn reachability_dep_node < ' tcx > ( _: CrateNum ) -> DepConstructor < ' tcx > {
991
997
DepConstructor :: Reachability
992
998
}
993
999
994
- fn mir_shim_dep_node ( instance : ty:: InstanceDef ) -> DepConstructor {
995
- instance. dep_node ( )
1000
+ fn mir_shim_dep_node < ' tcx > ( instance_def : ty:: InstanceDef < ' tcx > ) -> DepConstructor < ' tcx > {
1001
+ DepConstructor :: MirShim {
1002
+ instance_def
1003
+ }
996
1004
}
997
1005
998
- fn symbol_name_dep_node ( instance : ty:: Instance ) -> DepConstructor {
999
- // symbol_name uses the substs only to traverse them to find the
1000
- // hash, and that does not create any new dep-nodes.
1001
- DepConstructor :: SymbolName ( instance. def . def_id ( ) )
1006
+ fn symbol_name_dep_node < ' tcx > ( instance : ty:: Instance < ' tcx > ) -> DepConstructor < ' tcx > {
1007
+ DepConstructor :: InstanceSymbolName { instance }
1002
1008
}
1003
1009
1004
- fn typeck_item_bodies_dep_node ( _: CrateNum ) -> DepConstructor {
1010
+ fn typeck_item_bodies_dep_node < ' tcx > ( _: CrateNum ) -> DepConstructor < ' tcx > {
1005
1011
DepConstructor :: TypeckBodiesKrate
1006
1012
}
1007
1013
1008
- fn const_eval_dep_node ( ( def_id, _) : ( DefId , & Substs ) ) -> DepConstructor {
1014
+ fn const_eval_dep_node < ' tcx > ( ( def_id, _) : ( DefId , & Substs ) ) -> DepConstructor < ' tcx > {
1009
1015
DepConstructor :: ConstEval ( def_id)
1010
1016
}
1011
1017
1012
- fn mir_keys ( _: CrateNum ) -> DepConstructor {
1018
+ fn mir_keys < ' tcx > ( _: CrateNum ) -> DepConstructor < ' tcx > {
1013
1019
DepConstructor :: MirKeys
1014
1020
}
1015
1021
1016
- fn crate_variances ( _: CrateNum ) -> DepConstructor {
1022
+ fn crate_variances < ' tcx > ( _: CrateNum ) -> DepConstructor < ' tcx > {
1017
1023
DepConstructor :: CrateVariances
1018
1024
}
1019
1025
1020
- fn relevant_trait_impls_for ( ( def_id, _ ) : ( DefId , SimplifiedType ) ) -> DepConstructor {
1021
- DepConstructor :: TraitImpls ( def_id)
1026
+ fn relevant_trait_impls_for < ' tcx > ( ( def_id, t ) : ( DefId , SimplifiedType ) ) -> DepConstructor < ' tcx > {
1027
+ DepConstructor :: RelevantTraitImpls ( def_id, t )
1022
1028
}
1023
1029
1024
- fn is_copy_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor {
1030
+ fn is_copy_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor < ' tcx > {
1025
1031
let def_id = ty:: item_path:: characteristic_def_id_of_type ( key. value )
1026
1032
. unwrap_or ( DefId :: local ( CRATE_DEF_INDEX ) ) ;
1027
1033
DepConstructor :: IsCopy ( def_id)
1028
1034
}
1029
1035
1030
- fn is_sized_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor {
1036
+ fn is_sized_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor < ' tcx > {
1031
1037
let def_id = ty:: item_path:: characteristic_def_id_of_type ( key. value )
1032
1038
. unwrap_or ( DefId :: local ( CRATE_DEF_INDEX ) ) ;
1033
1039
DepConstructor :: IsSized ( def_id)
1034
1040
}
1035
1041
1036
- fn is_freeze_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor {
1042
+ fn is_freeze_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor < ' tcx > {
1037
1043
let def_id = ty:: item_path:: characteristic_def_id_of_type ( key. value )
1038
1044
. unwrap_or ( DefId :: local ( CRATE_DEF_INDEX ) ) ;
1039
1045
DepConstructor :: IsFreeze ( def_id)
1040
1046
}
1041
1047
1042
- fn needs_drop_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor {
1048
+ fn needs_drop_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor < ' tcx > {
1043
1049
let def_id = ty:: item_path:: characteristic_def_id_of_type ( key. value )
1044
1050
. unwrap_or ( DefId :: local ( CRATE_DEF_INDEX ) ) ;
1045
1051
DepConstructor :: NeedsDrop ( def_id)
1046
1052
}
1047
1053
1048
- fn layout_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor {
1054
+ fn layout_dep_node < ' tcx > ( key : ty:: ParamEnvAnd < ' tcx , Ty < ' tcx > > ) -> DepConstructor < ' tcx > {
1049
1055
let def_id = ty:: item_path:: characteristic_def_id_of_type ( key. value )
1050
1056
. unwrap_or ( DefId :: local ( CRATE_DEF_INDEX ) ) ;
1051
1057
DepConstructor :: Layout ( def_id)
0 commit comments