From 12297ab67533200748ee9f60da4bc86dee1133d9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 28 Mar 2020 13:19:05 +0100 Subject: Fix race in the tests --- crates/ra_cargo_watch/src/lib.rs | 2 +- crates/ra_prof/src/lib.rs | 8 ++++++++ crates/rust-analyzer/tests/heavy_tests/support.rs | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs index 1ced7712a..1cac954c3 100644 --- a/crates/ra_cargo_watch/src/lib.rs +++ b/crates/ra_cargo_watch/src/lib.rs @@ -35,10 +35,10 @@ pub struct CheckOptions { /// The spawned thread is shut down when this struct is dropped. #[derive(Debug)] pub struct CheckWatcher { - pub task_recv: Receiver, // XXX: drop order is significant cmd_send: Option>, handle: Option>, + pub task_recv: Receiver, } impl CheckWatcher { diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index 9e167db96..00ea3a9b0 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs @@ -339,6 +339,14 @@ pub fn print_backtrace() { let bt = backtrace::Backtrace::new(); 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 = RefCell::new(false)); diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index 1d7062bdf..67f3c9332 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs @@ -83,9 +83,10 @@ pub fn project(fixture: &str) -> Server { pub struct Server { req_id: Cell, messages: RefCell>, - dir: TempDir, _thread: jod_thread::JoinHandle<()>, client: Connection, + /// XXX: remove the tempdir last + dir: TempDir, } impl Server { -- cgit v1.2.3