mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Fix reporting of build script errors
This commit is contained in:
parent
095df7bc39
commit
0ff2c81bb9
2 changed files with 21 additions and 7 deletions
|
@ -196,6 +196,10 @@ impl WorkspaceBuildScripts {
|
||||||
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn error(&self) -> Option<&str> {
|
||||||
|
self.error.as_deref()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: File a better way to know if it is a dylib.
|
// FIXME: File a better way to know if it is a dylib.
|
||||||
|
|
|
@ -445,19 +445,29 @@ impl GlobalState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fetch_build_data_error(&self) -> Option<String> {
|
fn fetch_build_data_error(&self) -> Option<String> {
|
||||||
let mut buf = String::new();
|
let mut buf = "rust-analyzer failed to run build scripts:\n".to_string();
|
||||||
|
let mut has_errors = false;
|
||||||
|
|
||||||
for ws in &self.fetch_build_data_queue.last_op_result().1 {
|
for ws in &self.fetch_build_data_queue.last_op_result().1 {
|
||||||
if let Err(err) = ws {
|
match ws {
|
||||||
stdx::format_to!(buf, "rust-analyzer failed to run custom build: {:#}\n", err);
|
Ok(data) => {
|
||||||
|
if let Some(err) = data.error() {
|
||||||
|
has_errors = true;
|
||||||
|
stdx::format_to!(buf, "{:#}\n", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
has_errors = true;
|
||||||
|
stdx::format_to!(buf, "{:#}\n", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if buf.is_empty() {
|
if has_errors {
|
||||||
return None;
|
Some(buf)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(buf)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reload_flycheck(&mut self) {
|
fn reload_flycheck(&mut self) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue