Skip to content

Commit 12297ab

Browse files
committed
Fix race in the tests
1 parent f7df0b5 commit 12297ab

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

crates/ra_cargo_watch/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ pub struct CheckOptions {
3535
/// The spawned thread is shut down when this struct is dropped.
3636
#[derive(Debug)]
3737
pub struct CheckWatcher {
38-
pub task_recv: Receiver<CheckTask>,
3938
// XXX: drop order is significant
4039
cmd_send: Option<Sender<CheckCommand>>,
4140
handle: Option<jod_thread::JoinHandle<()>>,
41+
pub task_recv: Receiver<CheckTask>,
4242
}
4343

4444
impl CheckWatcher {

crates/ra_prof/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,14 @@ pub fn print_backtrace() {
339339
let bt = backtrace::Backtrace::new();
340340
eprintln!("{:?}", bt);
341341
}
342+
#[cfg(not(feature = "backtrace"))]
343+
pub fn print_backtrace() {
344+
eprintln!(
345+
r#"enable the backtrace feature:
346+
ra_prof = {{ path = "../ra_prof", features = [ "backtrace"] }}
347+
"#
348+
);
349+
}
342350

343351
thread_local!(static IN_SCOPE: RefCell<bool> = RefCell::new(false));
344352

crates/rust-analyzer/tests/heavy_tests/support.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ pub fn project(fixture: &str) -> Server {
8383
pub struct Server {
8484
req_id: Cell<u64>,
8585
messages: RefCell<Vec<Message>>,
86-
dir: TempDir,
8786
_thread: jod_thread::JoinHandle<()>,
8887
client: Connection,
88+
/// XXX: remove the tempdir last
89+
dir: TempDir,
8990
}
9091

9192
impl Server {

0 commit comments

Comments
 (0)