@@ -4,7 +4,7 @@ use std::mem;
44use rustc_data_structures:: hash_table:: { Entry , HashTable } ;
55use rustc_data_structures:: stack:: ensure_sufficient_stack;
66use rustc_data_structures:: { outline, sharded, sync} ;
7- use rustc_errors:: { Diag , FatalError , StashKey } ;
7+ use rustc_errors:: { FatalError , StashKey } ;
88use rustc_middle:: dep_graph:: { DepGraphData , DepNodeKey , SerializedDepNodeIndex } ;
99use rustc_middle:: query:: plumbing:: QueryVTable ;
1010use rustc_middle:: query:: {
@@ -108,24 +108,14 @@ fn mk_cycle<'tcx, C: QueryCache>(
108108 cycle_error : CycleError ,
109109) -> C :: Value {
110110 let error = report_cycle ( tcx. sess , & cycle_error) ;
111- handle_cycle_error ( query, tcx, & cycle_error, error)
112- }
113-
114- fn handle_cycle_error < ' tcx , C : QueryCache > (
115- query : & ' tcx QueryVTable < ' tcx , C > ,
116- tcx : TyCtxt < ' tcx > ,
117- cycle_error : & CycleError ,
118- error : Diag < ' _ > ,
119- ) -> C :: Value {
120111 match query. cycle_error_handling {
121112 CycleErrorHandling :: Error => {
122113 let guar = error. emit ( ) ;
123114 query. value_from_cycle_error ( tcx, cycle_error, guar)
124115 }
125116 CycleErrorHandling :: Fatal => {
126- error. emit ( ) ;
127- tcx. dcx ( ) . abort_if_errors ( ) ;
128- unreachable ! ( )
117+ let guar = error. emit ( ) ;
118+ guar. raise_fatal ( ) ;
129119 }
130120 CycleErrorHandling :: DelayBug => {
131121 let guar = error. delay_as_bug ( ) ;
@@ -322,15 +312,15 @@ fn try_execute_query<'tcx, C: QueryCache, const INCR: bool>(
322312
323313 // Only call `wait_for_query` if we're using a Rayon thread pool
324314 // as it will attempt to mark the worker thread as blocked.
325- return wait_for_query ( query, tcx, span, key, latch, current_job_id) ;
326- }
327-
328- let id = job. id ;
329- drop ( state_lock) ;
315+ wait_for_query ( query, tcx, span, key, latch, current_job_id)
316+ } else {
317+ let id = job. id ;
318+ drop ( state_lock) ;
330319
331- // If we are single-threaded we know that we have cycle error,
332- // so we just return the error.
333- cycle_error ( query, tcx, id, span)
320+ // If we are single-threaded we know that we have cycle error,
321+ // so we just return the error.
322+ cycle_error ( query, tcx, id, span)
323+ }
334324 }
335325 ActiveKeyStatus :: Poisoned => FatalError . raise ( ) ,
336326 }
@@ -412,27 +402,21 @@ fn execute_job_non_incr<'tcx, C: QueryCache>(
412402) -> ( C :: Value , DepNodeIndex ) {
413403 debug_assert ! ( !tcx. dep_graph. is_fully_enabled( ) ) ;
414404
415- // Fingerprint the key, just to assert that it doesn't
416- // have anything we don't consider hashable
417- if cfg ! ( debug_assertions) {
418- let _ = key. to_fingerprint ( tcx) ;
419- }
420-
421405 let prof_timer = tcx. prof . query_provider ( ) ;
422406 // Call the query provider.
423407 let result =
424408 start_query ( tcx, job_id, query. depth_limit , || ( query. invoke_provider_fn ) ( tcx, key) ) ;
425409 let dep_node_index = tcx. dep_graph . next_virtual_depnode_index ( ) ;
426410 prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
427411
428- // Similarly, fingerprint the result to assert that
429- // it doesn't have anything not considered hashable.
430- if cfg ! ( debug_assertions )
431- && let Some ( hash_result) = query. hash_result
432- {
433- tcx . with_stable_hashing_context ( | mut hcx| {
434- hash_result ( & mut hcx , & result ) ;
435- } ) ;
412+ // Sanity: Fingerprint the key and the result to assert they don't contain anything unhashable.
413+ if cfg ! ( debug_assertions ) {
414+ let _ = key . to_fingerprint ( tcx ) ;
415+ if let Some ( hash_result) = query. hash_result {
416+ tcx . with_stable_hashing_context ( | mut hcx| {
417+ hash_result ( & mut hcx, & result ) ;
418+ } ) ;
419+ }
436420 }
437421
438422 ( result, dep_node_index)
0 commit comments