-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Fix reporting of build script errors #10024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,14 +232,6 @@ impl GlobalState { | |
| let mut res = Vec::new(); | ||
| for ws in workspaces.iter() { | ||
| res.push(ws.run_build_scripts(&config, &progress)); | ||
| let ws = match ws { | ||
| ProjectWorkspace::Cargo { cargo, .. } => cargo, | ||
| ProjectWorkspace::DetachedFiles { .. } | ProjectWorkspace::Json { .. } => { | ||
| res.push(Ok(WorkspaceBuildScripts::default())); | ||
| continue; | ||
| } | ||
| }; | ||
| res.push(WorkspaceBuildScripts::run(&config, ws, &progress)) | ||
| } | ||
| sender.send(Task::FetchBuildData(BuildDataProgress::End((workspaces, res)))).unwrap(); | ||
| }); | ||
|
|
@@ -453,19 +445,29 @@ impl GlobalState { | |
| } | ||
|
|
||
| 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 { | ||
| if let Err(err) = ws { | ||
| stdx::format_to!(buf, "rust-analyzer failed to run custom build: {:#}\n", err); | ||
| match ws { | ||
| Ok(data) => { | ||
| if let Some(err) = data.error() { | ||
| has_errors = true; | ||
| stdx::format_to!(buf, "{:#}\n", err); | ||
| } | ||
|
Comment on lines
+454
to
+457
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was semi-intentional -- if just becaues borrow checked doesn't favor you today.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This -- the absense of errore reporting for the cases wheer
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this still seems to work correctly
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although rust-analyzer does not seem to recover when there is a build error in a build script, even after clicking on that item after fixing the issue |
||
| } | ||
| Err(err) => { | ||
| has_errors = true; | ||
| stdx::format_to!(buf, "{:#}\n", err); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if buf.is_empty() { | ||
| return None; | ||
| if has_errors { | ||
| Some(buf) | ||
| } else { | ||
| None | ||
| } | ||
|
|
||
| Some(buf) | ||
| } | ||
|
|
||
| fn reload_flycheck(&mut self) { | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.