@@ -90,6 +90,10 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
90
90
}
91
91
return TryGetJob :: JobCompleted ( result) ;
92
92
}
93
+
94
+ #[ cfg( parallel_compiler) ]
95
+ let query_blocked_prof_timer;
96
+
93
97
let job = match lock. active . entry ( ( * key) . clone ( ) ) {
94
98
Entry :: Occupied ( entry) => {
95
99
match * entry. get ( ) {
@@ -98,7 +102,9 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
98
102
// in another thread has completed. Record how long we wait in the
99
103
// self-profiler.
100
104
#[ cfg( parallel_compiler) ]
101
- tcx. prof . query_blocked_start ( Q :: NAME ) ;
105
+ {
106
+ query_blocked_prof_timer = tcx. prof . query_blocked ( Q :: NAME ) ;
107
+ }
102
108
103
109
job. clone ( )
104
110
} ,
@@ -140,7 +146,11 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
140
146
#[ cfg( parallel_compiler) ]
141
147
{
142
148
let result = job. r#await ( tcx, span) ;
143
- tcx. prof . query_blocked_end ( Q :: NAME ) ;
149
+
150
+ // This `drop()` is not strictly necessary as the binding
151
+ // would go out of scope anyway. But it's good to have an
152
+ // explicit marker of how far the measurement goes.
153
+ drop ( query_blocked_prof_timer) ;
144
154
145
155
if let Err ( cycle) = result {
146
156
return TryGetJob :: Cycle ( Q :: handle_cycle_error ( tcx, cycle) ) ;
0 commit comments