mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Fix race in the tests
This commit is contained in:
parent
f7df0b56a7
commit
12297ab675
3 changed files with 11 additions and 2 deletions
|
@ -35,10 +35,10 @@ pub struct CheckOptions {
|
||||||
/// The spawned thread is shut down when this struct is dropped.
|
/// The spawned thread is shut down when this struct is dropped.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct CheckWatcher {
|
pub struct CheckWatcher {
|
||||||
pub task_recv: Receiver<CheckTask>,
|
|
||||||
// XXX: drop order is significant
|
// XXX: drop order is significant
|
||||||
cmd_send: Option<Sender<CheckCommand>>,
|
cmd_send: Option<Sender<CheckCommand>>,
|
||||||
handle: Option<jod_thread::JoinHandle<()>>,
|
handle: Option<jod_thread::JoinHandle<()>>,
|
||||||
|
pub task_recv: Receiver<CheckTask>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CheckWatcher {
|
impl CheckWatcher {
|
||||||
|
|
|
@ -339,6 +339,14 @@ pub fn print_backtrace() {
|
||||||
let bt = backtrace::Backtrace::new();
|
let bt = backtrace::Backtrace::new();
|
||||||
eprintln!("{:?}", bt);
|
eprintln!("{:?}", bt);
|
||||||
}
|
}
|
||||||
|
#[cfg(not(feature = "backtrace"))]
|
||||||
|
pub fn print_backtrace() {
|
||||||
|
eprintln!(
|
||||||
|
r#"enable the backtrace feature:
|
||||||
|
ra_prof = {{ path = "../ra_prof", features = [ "backtrace"] }}
|
||||||
|
"#
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
thread_local!(static IN_SCOPE: RefCell<bool> = RefCell::new(false));
|
thread_local!(static IN_SCOPE: RefCell<bool> = RefCell::new(false));
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,10 @@ pub fn project(fixture: &str) -> Server {
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
req_id: Cell<u64>,
|
req_id: Cell<u64>,
|
||||||
messages: RefCell<Vec<Message>>,
|
messages: RefCell<Vec<Message>>,
|
||||||
dir: TempDir,
|
|
||||||
_thread: jod_thread::JoinHandle<()>,
|
_thread: jod_thread::JoinHandle<()>,
|
||||||
client: Connection,
|
client: Connection,
|
||||||
|
/// XXX: remove the tempdir last
|
||||||
|
dir: TempDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Server {
|
impl Server {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue