mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Fix waiting on a query that panicked
This commit is contained in:
parent
58eefc33ad
commit
3040d92dc4
@ -300,7 +300,18 @@ where
|
||||
match result {
|
||||
Ok(()) => {
|
||||
let Some((v, index)) = query.query_cache(qcx).lookup(&key) else {
|
||||
cold_path(|| panic!("value must be in cache after waiting"))
|
||||
cold_path(|| {
|
||||
// We didn't find the query result in the query cache. Check if it was
|
||||
// poisoned due to a panic instead.
|
||||
let lock = query.query_state(qcx).active.get_shard_by_value(&key).lock();
|
||||
match lock.get(&key) {
|
||||
// The query we waited on panicked. Continue unwinding here.
|
||||
Some(QueryResult::Poisoned) => FatalError.raise(),
|
||||
_ => panic!(
|
||||
"query result must in the cache or the query must be poisoned after a wait"
|
||||
),
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
qcx.dep_context().profiler().query_cache_hit(index.into());
|
||||
|
Loading…
Reference in New Issue
Block a user