-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Rust-Analyzer shows no diagnostics from check build #13057
Comments
Oh, actually, maybe those errors are not the actual cause of the problem? I made
I guess it's time to disable build scripts again -- when they fail (which happens fairly regularly for me), they seem to take all the rest of the RA features down with them. |
Hm, no... no build scripts, no error message, but also no diagnostics. The weirdest thing is, it worked fine half an hour ago. I have not changed any configuration. |
I'll try to get the |
I am told it works with the bash in git-for-windows. |
But note that most of these issues also apply to rustc itself, and its What happens this time though where it just silently drops all errors and pretends like nothing happens... no idea, I don't think I saw that before. |
I'd assume so, it's more the question how to get r-a to invoke it via that |
Rustc usually works fine for me, though I don't hack on the codebase, I only use r-a to browse there which mostly works. |
Ah, the issue also affects the rustc repo. Ctrl-S does nothing (a check-build of rustc after changing libcore takes at least a minute, so it should be sitting there for a bit telling me it is doing a check-build, but it does not even flicker), and no errors are shown. So I assume an RA update was auto-installed in the last half an hour and that broke everything. Strangely, in Miri, when I do Ctrl-S it does pretend to run |
Can reproduce it in miri, native diagnostics don't work for me there either. Will go dig around what the cause might (probably don't have the time to tonight) |
Downgrading to v0.3.1162 doesn't help either though. Why did this suddenly just break when I restarted vscode...? |
Is there some component of RA that is tracked and updated separately? The status message when doing the check-on-save build used to be |
Oh but now it shows diagnostics again. 🙏 |
This behavior should be quite a bit older already though I believe. I wonder if VSCode mixed your installs, iirc there have been very few occurences where the client and server versions did not match up properly for some people for some reason |
OKay, turns out using git bash did not work which fooled me instead. Managed to get it running and now I also see a ton of |
Strange, I am pretty sure it was Well, after downgrading and re-upgrading, diagnostics in Miri seem to work again. In rustc turns out this was my fault, I had changed the checkOnSave command to The issue disappeared as mysteriously as it appeared... |
cargo-miri diagnostics work for me with these settings // Place your settings in this file to overwrite default and user settings.
{
"rust-analyzer.rustc.source": "discover",
"rust-analyzer.linkedProjects": [
"./Cargo.toml",
"./cargo-miri/Cargo.toml"
],
"rust-analyzer.checkOnSave.overrideCommand": [
"./miri",
"clippy",
"--message-format=json"
],
// Contrary to what the name suggests, this also affects proc macros.
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"./miri",
"check",
"--message-format=json",
],
} They only show up when main Miri builds successfully though, I think. |
Ah! It's |
Ye I just checked, we show the override command, unless more than one check processes are running, then we show |
Alright, so the main issue here (things not working at all) fixed itself after switching around with your extension versions if I understand correctly? The other issue that spawns the error log messages is
If you save a file we now only trigger checks for the workspaces that contain the file. The So regarding |
Looks like it, yes...
Right, but I did save a file in cargo-miri. However I realized now that
However I can see how that is problematic for RA... errors in cargo-miri show up as
and there is no way for RA to know what that filename is relative to. (This is annoying even for humans.) |
So what I was hoping for originally is some way to set a single command to be used across all linked projects/crates/workspaces -- rather than what RA currently does, which is to run this command separately for each workspace. But while rust-lang/cargo#11007 remains unsolved, this might not be possible? The problem with running the command for all workspaces is that the command doesn't even know which workspace to build, and a For Miri what I could imagine is that rather than overwriting the entire command, we could have a way to wrap the existing command. Miri could then use that to set the environment variables it needs to set, and forward the rest to cargo, thus allowing the caller to select the project they want to have built. I am not sure if that would work for rustc, though... |
I think rust-lang/miri#2495 helps with this on the Miri side. IMO what RA could do here is, rather than changing the working directory to go check the different linked workspaces, it could stay in the same working directory and pass At the least, it would be good to extend the docs for So for Miri we have a pretty good work-around now I think, that should avoid any ignored diagnostics by only building the project that RA asked to build. But for rustc (in particular, rustc bootstrap) we don't have a solution. The |
For what we are discussing here, this should probably be closed as a duplicate of #10793 ? |
Ye I think we can close this as a dupe and continue discussion in that issue. (I'll read through this and drop my input in the other issue after the weekend) |
Sometimes when I open Miri in vsocde, I get no diagnostics and RA says build scripts don't work. I now found this in the error log:
(and a lot of similar ones)
This is correct, there is no such file. The correct location is
/home/r/src/rust/miri/src/stacked_borrows/mod.rs
.I think this is related to #10793: the workspace settings are
To work around #10793, we have
./miri
not just in the root folder but also incargo-miri
. They both run the same script. But unfortunately sometimes that means RA interprets the filenames in the diagnostics as being relative to thecargo-miri
subdir, which they are not.We can make
cargo-miri/miri
a NOP, but then RA shows no diagnostics at all inside cargo-miri. Running the checkOnSave.overrideCommand will produce those diagnostics, but RA usually ignores them. So it seems sometimes diagnostics for 'other' projects are ignored, so we need both./miri
and./cargo-miri/miri
to produce output, but sometimes they are not ignored, which then breaks RA entirely.Is there any way at all to reliably use RA with multiple linked projects in different directories, and a relative path in
checkOnSave.overrideCommand
? Currently, all work-arounds that I know entirely fail sometimes. :( (This affects not only Miri, but also rustc itself, where RA does not work in the crates that are not in the main rustc workspace, such as bootstrap or codegen_cranelift.)The text was updated successfully, but these errors were encountered: