about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-22 15:43:13 +0000
committerbors <bors@rust-lang.org>2022-08-22 15:43:13 +0000
commit6711ded5cdbb6045e8d1e62ba71c98c4fc857601 (patch)
tree3a6c49098f4a1e981e0126176f2ce741e73fd325
parentfdc28b4333c7fccafbb85af7ccddbbf6f96df9a0 (diff)
parent2abb78d06d958ec9ce6c63e11bbeb9d5e273513b (diff)
downloadrust-6711ded5cdbb6045e8d1e62ba71c98c4fc857601.tar.gz
rust-6711ded5cdbb6045e8d1e62ba71c98c4fc857601.zip
Auto merge of #13088 - Veykril:flycheck-failure, r=Veykril
Pop an error notification when flycheck can't be restarted
-rw-r--r--crates/flycheck/src/lib.rs10
-rw-r--r--crates/rust-analyzer/src/main_loop.rs7
2 files changed, 13 insertions, 4 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index c22945c81fc..d9f4ef5b7ff 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -125,6 +125,7 @@ pub enum Progress {
     DidCheckCrate(String),
     DidFinish(io::Result<()>),
     DidCancel,
+    DidFailToRestart(String),
 }
 
 enum Restart {
@@ -193,10 +194,11 @@ impl FlycheckActor {
                             self.progress(Progress::DidStart);
                         }
                         Err(error) => {
-                            tracing::error!(
-                                command = ?self.check_command(),
-                                %error, "failed to restart flycheck"
-                            );
+                            self.progress(Progress::DidFailToRestart(format!(
+                                "Failed to run the following command: {:?} error={}",
+                                self.check_command(),
+                                error
+                            )));
                         }
                     }
                 }
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index f187547019a..122aba2f7d9 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -529,6 +529,13 @@ impl GlobalState {
                     }
                     flycheck::Progress::DidCheckCrate(target) => (Progress::Report, Some(target)),
                     flycheck::Progress::DidCancel => (Progress::End, None),
+                    flycheck::Progress::DidFailToRestart(err) => {
+                        self.show_and_log_error(
+                            "cargo check failed".to_string(),
+                            Some(err.to_string()),
+                        );
+                        return;
+                    }
                     flycheck::Progress::DidFinish(result) => {
                         if let Err(err) = result {
                             self.show_and_log_error(