-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Optional Context
I've been trying to debug why include!(concat!(env!("OUT_DIR", ...)); doesn't work for me and had no better ways then to clone rust-analyzer and add dbg!() logs to discover that cargo check for my workspace was failing due to a panic in the build script.
IIRC cargo check failures were reported previously, but some patch introduced a regression somewhere
Summary
The initial cargo check that rust-analyzer uses to fill in the project model may fail, but this error is not reported in any way.
I suggest at least adding an error-level log so that this can be discovered in the Output tab of Rust Analyzer Language Server.
Implementation Notes
Basically, the error field on this struct here is unused:
https://github.com/rust-analyzer/rust-analyzer/blob/2511e1bc35abec0cd56695c2d52ff5e572576943/crates/project_model/src/build_scripts.rs#L23-L27
It is only written to here:
https://github.com/rust-analyzer/rust-analyzer/blob/2511e1bc35abec0cd56695c2d52ff5e572576943/crates/project_model/src/build_scripts.rs#L194
But it is never read afterwards (removing the field confirms my theory because the project compiles without it).
I suppose @matklad had some further usage for it in mind but forgot to add it, and rustc doesn't report unused lint for this field for some reason, so this slipped in to master.
The simplest fix here would be to add log::error!() right at the place where the error is encountered, but please consult with @matklad first