don't poison mutex around chalk
We use panics for cancellation, so we could trigger panic while holding the solver. std::sync::Mutex will be poisoned as a result, which and all further attempts to use solver (from other threads) will panic as well. This commit switches to parking_lot::Mutex which just unlocks on panic.
This commit is contained in:
parent
5023860a55
commit
f89d34be6a
@ -1,5 +1,6 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::Arc;
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use ra_syntax::{SyntaxNode, TreeArc, SmolStr, ast};
|
||||
use ra_db::{SourceDatabase, salsa};
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! Trait solving using Chalk.
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::Arc;
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use rustc_hash::FxHashSet;
|
||||
use log::debug;
|
||||
use chalk_ir::cast::Cast;
|
||||
@ -61,7 +62,7 @@ fn solve(
|
||||
let context = ChalkContext { db, krate };
|
||||
let solver = db.solver(krate);
|
||||
debug!("solve goal: {:?}", goal);
|
||||
let solution = solver.lock().unwrap().solve_with_fuel(&context, goal, Some(1000));
|
||||
let solution = solver.lock().solve_with_fuel(&context, goal, Some(1000));
|
||||
debug!("solve({:?}) => {:?}", goal, solution);
|
||||
solution
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user