diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-08-25 03:34:17 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-08-25 03:34:36 +0200 |
| commit | 3040d92dc46e6074fcc15bc2b8ed0516e81d573c (patch) | |
| tree | 6eebc60aab3e023a4bb97f255f1b94aef5455b5d /compiler | |
| parent | 58eefc33adf769a1abe12ad94b3e6811185b4ce5 (diff) | |
| download | rust-3040d92dc46e6074fcc15bc2b8ed0516e81d573c.tar.gz rust-3040d92dc46e6074fcc15bc2b8ed0516e81d573c.zip | |
Fix waiting on a query that panicked
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_query_system/src/query/plumbing.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 4adb4eb7475..575921b3337 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -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()); |
