Skip to content

Commit 4fac739

Browse files
committed
Fix a race condition
1 parent ecd5efa commit 4fac739

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc/ty/query/job.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ impl<'tcx> QueryJob<'tcx> {
103103
condvar: Condvar::new(),
104104
});
105105
self.latch.await(&waiter);
106-
107-
match Lrc::get_mut(&mut waiter).unwrap().cycle.get_mut().take() {
106+
// FIXME: Get rid of this lock. We have ownership of the QueryWaiter
107+
// although another thread may still have a Lrc reference so we cannot
108+
// use Lrc::get_mut
109+
let mut cycle = waiter.cycle.lock();
110+
match cycle.take() {
108111
None => Ok(()),
109112
Some(cycle) => Err(cycle)
110113
}

0 commit comments

Comments
 (0)