@@ -28,7 +28,6 @@ pub(crate) struct QueryVtable<CTX: QueryContext, K, V> {
2828 pub anon : bool ,
2929 pub dep_kind : CTX :: DepKind ,
3030 pub eval_always : bool ,
31- pub to_dep_node : fn ( CTX , & K ) -> DepNode < CTX :: DepKind > ,
3231
3332 // Don't use this method to compute query results, instead use the methods on TyCtxt
3433 pub compute : fn ( CTX , K ) -> V ,
@@ -40,8 +39,11 @@ pub(crate) struct QueryVtable<CTX: QueryContext, K, V> {
4039}
4140
4241impl < CTX : QueryContext , K , V > QueryVtable < CTX , K , V > {
43- pub ( crate ) fn to_dep_node ( & self , tcx : CTX , key : & K ) -> DepNode < CTX :: DepKind > {
44- ( self . to_dep_node ) ( tcx, key)
42+ pub ( crate ) fn to_dep_node ( & self , tcx : CTX , key : & K ) -> DepNode < CTX :: DepKind >
43+ where
44+ K : crate :: dep_graph:: DepNodeParams < CTX > ,
45+ {
46+ DepNode :: construct ( tcx, self . dep_kind , key)
4547 }
4648
4749 pub ( crate ) fn compute ( & self , tcx : CTX , key : K ) -> V {
@@ -79,7 +81,12 @@ pub trait QueryAccessors<CTX: QueryContext>: QueryConfig<CTX> {
7981 // Don't use this method to access query results, instead use the methods on TyCtxt
8082 fn query_state < ' a > ( tcx : CTX ) -> & ' a QueryState < CTX , Self :: Cache > ;
8183
82- fn to_dep_node ( tcx : CTX , key : & Self :: Key ) -> DepNode < CTX :: DepKind > ;
84+ fn to_dep_node ( tcx : CTX , key : & Self :: Key ) -> DepNode < CTX :: DepKind >
85+ where
86+ Self :: Key : crate :: dep_graph:: DepNodeParams < CTX > ,
87+ {
88+ DepNode :: construct ( tcx, Self :: DEP_KIND , key)
89+ }
8390
8491 // Don't use this method to compute query results, instead use the methods on TyCtxt
8592 fn compute ( tcx : CTX , key : Self :: Key ) -> Self :: Value ;
@@ -117,7 +124,6 @@ where
117124 const VTABLE : QueryVtable < CTX , Q :: Key , Q :: Value > = QueryVtable {
118125 anon : Q :: ANON ,
119126 dep_kind : Q :: DEP_KIND ,
120- to_dep_node : Q :: to_dep_node,
121127 eval_always : Q :: EVAL_ALWAYS ,
122128 compute : Q :: compute,
123129 hash_result : Q :: hash_result,
0 commit comments