99// except according to those terms.
1010
1111use errors:: DiagnosticBuilder ;
12- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher ,
13- StableHashingContextProvider } ;
12+ use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
1413use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
1514use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
1615use rustc_data_structures:: sync:: Lrc ;
@@ -20,7 +19,7 @@ use std::hash::Hash;
2019use ty:: TyCtxt ;
2120use util:: common:: { ProfileQueriesMsg , profq_msg} ;
2221
23- use ich:: Fingerprint ;
22+ use ich:: { StableHashingContext , StableHashingContextProvider , Fingerprint } ;
2423
2524use super :: debug:: EdgeFilter ;
2625use super :: dep_node:: { DepNode , DepKind , WorkProductId } ;
@@ -189,47 +188,49 @@ impl DepGraph {
189188 /// `arg` parameter.
190189 ///
191190 /// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/incremental-compilation.html
192- pub fn with_task < C , A , R , HCX > ( & self ,
191+ pub fn with_task < ' gcx , C , A , R > ( & self ,
193192 key : DepNode ,
194193 cx : C ,
195194 arg : A ,
196195 task : fn ( C , A ) -> R )
197196 -> ( R , DepNodeIndex )
198- where C : DepGraphSafe + StableHashingContextProvider < ContextType = HCX > ,
199- R : HashStable < HCX > ,
197+ where C : DepGraphSafe + StableHashingContextProvider < ' gcx > ,
198+ R : HashStable < StableHashingContext < ' gcx > > ,
200199 {
201200 self . with_task_impl ( key, cx, arg, task,
202201 |data, key| data. borrow_mut ( ) . push_task ( key) ,
203202 |data, key| data. borrow_mut ( ) . pop_task ( key) )
204203 }
205204
206- fn with_task_impl < C , A , R , HCX > ( & self ,
205+ fn with_task_impl < ' gcx , C , A , R > ( & self ,
207206 key : DepNode ,
208207 cx : C ,
209208 arg : A ,
210209 task : fn ( C , A ) -> R ,
211210 push : fn ( & RefCell < CurrentDepGraph > , DepNode ) ,
212211 pop : fn ( & RefCell < CurrentDepGraph > , DepNode ) -> DepNodeIndex )
213212 -> ( R , DepNodeIndex )
214- where C : DepGraphSafe + StableHashingContextProvider < ContextType = HCX > ,
215- R : HashStable < HCX > ,
213+ where C : DepGraphSafe + StableHashingContextProvider < ' gcx > ,
214+ R : HashStable < StableHashingContext < ' gcx > > ,
216215 {
217216 if let Some ( ref data) = self . data {
218217 push ( & data. current , key) ;
219- if cfg ! ( debug_assertions) {
220- profq_msg ( ProfileQueriesMsg :: TaskBegin ( key. clone ( ) ) )
221- } ;
222218
223219 // In incremental mode, hash the result of the task. We don't
224220 // do anything with the hash yet, but we are computing it
225221 // anyway so that
226222 // - we make sure that the infrastructure works and
227223 // - we can get an idea of the runtime cost.
228- let mut hcx = cx. create_stable_hashing_context ( ) ;
224+ let mut hcx = cx. get_stable_hashing_context ( ) ;
225+
226+ if cfg ! ( debug_assertions) {
227+ profq_msg ( hcx. sess ( ) , ProfileQueriesMsg :: TaskBegin ( key. clone ( ) ) )
228+ } ;
229229
230230 let result = task ( cx, arg) ;
231+
231232 if cfg ! ( debug_assertions) {
232- profq_msg ( ProfileQueriesMsg :: TaskEnd )
233+ profq_msg ( hcx . sess ( ) , ProfileQueriesMsg :: TaskEnd )
233234 } ;
234235
235236 let dep_node_index = pop ( & data. current , key) ;
@@ -274,7 +275,7 @@ impl DepGraph {
274275 ( result, dep_node_index)
275276 } else {
276277 if key. kind . fingerprint_needed_for_crate_hash ( ) {
277- let mut hcx = cx. create_stable_hashing_context ( ) ;
278+ let mut hcx = cx. get_stable_hashing_context ( ) ;
278279 let result = task ( cx, arg) ;
279280 let mut stable_hasher = StableHasher :: new ( ) ;
280281 result. hash_stable ( & mut hcx, & mut stable_hasher) ;
@@ -314,14 +315,14 @@ impl DepGraph {
314315
315316 /// Execute something within an "eval-always" task which is a task
316317 // that runs whenever anything changes.
317- pub fn with_eval_always_task < C , A , R , HCX > ( & self ,
318+ pub fn with_eval_always_task < ' gcx , C , A , R > ( & self ,
318319 key : DepNode ,
319320 cx : C ,
320321 arg : A ,
321322 task : fn ( C , A ) -> R )
322323 -> ( R , DepNodeIndex )
323- where C : DepGraphSafe + StableHashingContextProvider < ContextType = HCX > ,
324- R : HashStable < HCX > ,
324+ where C : DepGraphSafe + StableHashingContextProvider < ' gcx > ,
325+ R : HashStable < StableHashingContext < ' gcx > > ,
325326 {
326327 self . with_task_impl ( key, cx, arg, task,
327328 |data, key| data. borrow_mut ( ) . push_eval_always_task ( key) ,
0 commit comments