Skip to content

Commit 6711ded

Browse files
committed
Auto merge of rust-lang#13088 - Veykril:flycheck-failure, r=Veykril
Pop an error notification when flycheck can't be restarted
2 parents fdc28b4 + 2abb78d commit 6711ded

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

crates/flycheck/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ pub enum Progress {
125125
DidCheckCrate(String),
126126
DidFinish(io::Result<()>),
127127
DidCancel,
128+
DidFailToRestart(String),
128129
}
129130

130131
enum Restart {
@@ -193,10 +194,11 @@ impl FlycheckActor {
193194
self.progress(Progress::DidStart);
194195
}
195196
Err(error) => {
196-
tracing::error!(
197-
command = ?self.check_command(),
198-
%error, "failed to restart flycheck"
199-
);
197+
self.progress(Progress::DidFailToRestart(format!(
198+
"Failed to run the following command: {:?} error={}",
199+
self.check_command(),
200+
error
201+
)));
200202
}
201203
}
202204
}

crates/rust-analyzer/src/main_loop.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,13 @@ impl GlobalState {
529529
}
530530
flycheck::Progress::DidCheckCrate(target) => (Progress::Report, Some(target)),
531531
flycheck::Progress::DidCancel => (Progress::End, None),
532+
flycheck::Progress::DidFailToRestart(err) => {
533+
self.show_and_log_error(
534+
"cargo check failed".to_string(),
535+
Some(err.to_string()),
536+
);
537+
return;
538+
}
532539
flycheck::Progress::DidFinish(result) => {
533540
if let Err(err) = result {
534541
self.show_and_log_error(

0 commit comments

Comments
 (0)