@@ -23,7 +23,7 @@ use super::debug::EdgeFilter;
2323use super :: prev:: PreviousDepGraph ;
2424use super :: query:: DepGraphQuery ;
2525use super :: serialized:: SerializedDepNodeIndex ;
26- use super :: { DepContext , DepKind , DepNode , WorkProductId } ;
26+ use super :: { DepContext , DepKind , DepNode , HasDepContext , WorkProductId } ;
2727
2828#[ derive( Clone ) ]
2929pub struct DepGraph < K : DepKind > {
@@ -235,7 +235,7 @@ impl<K: DepKind> DepGraph<K> {
235235 /// `arg` parameter.
236236 ///
237237 /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/incremental-compilation.html
238- pub fn with_task < Ctxt : DepContext < DepKind = K > , A , R > (
238+ pub fn with_task < Ctxt : HasDepContext < DepKind = K > , A , R > (
239239 & self ,
240240 key : DepNode < K > ,
241241 cx : Ctxt ,
@@ -261,7 +261,7 @@ impl<K: DepKind> DepGraph<K> {
261261 )
262262 }
263263
264- fn with_task_impl < Ctxt : DepContext < DepKind = K > , A , R > (
264+ fn with_task_impl < Ctxt : HasDepContext < DepKind = K > , A , R > (
265265 & self ,
266266 key : DepNode < K > ,
267267 cx : Ctxt ,
@@ -271,14 +271,15 @@ impl<K: DepKind> DepGraph<K> {
271271 hash_result : impl FnOnce ( & mut Ctxt :: StableHashingContext , & R ) -> Option < Fingerprint > ,
272272 ) -> ( R , DepNodeIndex ) {
273273 if let Some ( ref data) = self . data {
274+ let dcx = cx. dep_context ( ) ;
274275 let task_deps = create_task ( key) . map ( Lock :: new) ;
275276 let result = K :: with_deps ( task_deps. as_ref ( ) , || task ( cx, arg) ) ;
276277 let edges = task_deps. map_or_else ( || smallvec ! [ ] , |lock| lock. into_inner ( ) . reads ) ;
277278
278- let mut hcx = cx . create_stable_hashing_context ( ) ;
279+ let mut hcx = dcx . create_stable_hashing_context ( ) ;
279280 let current_fingerprint = hash_result ( & mut hcx, & result) ;
280281
281- let print_status = cfg ! ( debug_assertions) && cx . debug_dep_tasks ( ) ;
282+ let print_status = cfg ! ( debug_assertions) && dcx . debug_dep_tasks ( ) ;
282283
283284 // Intern the new `DepNode`.
284285 let dep_node_index = if let Some ( prev_index) = data. previous . node_to_index_opt ( & key) {
@@ -408,7 +409,7 @@ impl<K: DepKind> DepGraph<K> {
408409
409410 /// Executes something within an "eval-always" task which is a task
410411 /// that runs whenever anything changes.
411- pub fn with_eval_always_task < Ctxt : DepContext < DepKind = K > , A , R > (
412+ pub fn with_eval_always_task < Ctxt : HasDepContext < DepKind = K > , A , R > (
412413 & self ,
413414 key : DepNode < K > ,
414415 cx : Ctxt ,
0 commit comments