Vscode rust-analyzer no error underlining in bin or tests directories

I now no longer get error underlining for .rs files in my crate_root/src/bin and crate_root/tests. I'm not sure what specifically caused the change, I used to get these before.

Modules in the lib.rs tree do get error underlining.

Saving the files in bin and tests triggers a flycheck. On older version of rust-analyzer no errors or warnings appear in the Rust Analyzer Language Server output window, with or without RA_LOG=info.

After updating to the 2023-02-05 version of rust-analyzer I get this error on server start, but no additional errors on check.

Error: Custom { kind: InvalidData, error: Error("unknown variant `ApiVersionCheck`, expected `ListMacros` or `ExpandMacro`", line: 1, column: 18) }
Error: Custom { kind: InvalidData, error: Error("unknown variant `ApiVersionCheck`, expected `ListMacros` or `ExpandMacro`", line: 1, column: 18) }
Error: Custom { kind: InvalidData, error: Error("unknown variant `ApiVersionCheck`, expected `ListMacros` or `ExpandMacro`", line: 1, column: 18) }

The most notable thing I can tell from Rust Analyzer Language Server Trace is that no Received notification 'textDocument/publishDiagnostics'. blocks appear for the bin and test files, while those blocks do appear for the files in the lib tree.

It seems like these files might get covered by a cargo check at some point because I do get inlay hints, code lens, and code actions to attempt to fix compilation errors. If I run cargo check --tests in the project crate directory all files get covered and report errors.

image

I am on rust-analyzer server version 0.0.0 (0b32b65ca 2023-02-05) and extension version 0.3.1394, which I think is about as up to date as I can be. I was seeing this issue on older versions and updated to see if it would go away. My VS Code version is 1.75.0.

When I created a new cargo project I could not reproduce the issue.
Opening the same cargo project in a new workspace does reproduce the issue.

What might be the problem causing my runnable files not to get error highlighting? Are there further steps I could take to diagnose the problem?

The issue appears to be that there were #[deny(...)] clippy lints in the library code.

Apparently this prevents the executable code from being checked.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.