File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
compiler/rustc_query_system/src/query Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,18 @@ enum QueryResult {
44
44
Poisoned ,
45
45
}
46
46
47
+ impl QueryResult {
48
+
49
+ /// Unwraps the query job and if poisoned will raise a [`FatalError`]
50
+ fn unwrap ( self ) -> QueryJob {
51
+ match self {
52
+ Self :: Started ( job) => job,
53
+ Self :: Poisoned => FatalError . raise ( ) ,
54
+ }
55
+ }
56
+
57
+ }
58
+
47
59
impl < K > QueryState < K >
48
60
where
49
61
K : Eq + Hash + Copy + Debug ,
@@ -169,10 +181,7 @@ where
169
181
170
182
let job = {
171
183
let mut lock = state. active . lock_shard_by_value ( & key) ;
172
- match lock. remove ( & key) . unwrap ( ) {
173
- QueryResult :: Started ( job) => job,
174
- QueryResult :: Poisoned => panic ! ( ) ,
175
- }
184
+ lock. remove ( & key) . unwrap ( ) . unwrap ( )
176
185
} ;
177
186
178
187
job. signal_complete ( ) ;
@@ -190,10 +199,8 @@ where
190
199
let state = self . state ;
191
200
let job = {
192
201
let mut shard = state. active . lock_shard_by_value ( & self . key ) ;
193
- let job = match shard. remove ( & self . key ) . unwrap ( ) {
194
- QueryResult :: Started ( job) => job,
195
- QueryResult :: Poisoned => panic ! ( ) ,
196
- } ;
202
+ let job = shard. remove ( & self . key ) . unwrap ( ) . unwrap ( ) ;
203
+
197
204
shard. insert ( self . key , QueryResult :: Poisoned ) ;
198
205
job
199
206
} ;
You can’t perform that action at this time.
0 commit comments