Rust analyzer is not picking up one particular module of a cargo project

Hey, I have a bit of a strange problem. I tried two setups one with neovim (lspconfig) and the other with vscode and both have the same exact problem

I am starting to contribute to an existing open source rust projet which has a structure similar to the below (the real one is a bit complex so I will share a link to the repo but this domenstrates the problem I am having)

        |-----> module 1
project |
        |-----> module 2

The problem is essentially that rust-analyzer works perfectly fine for the code in module1 but does not work at all for any of the files in module2 (i.e. autocompletion does not work and jumping into modules does not work). I thought there is a good chance that the problem is with module 2 but I cannot really tell a significant difference between the setup of both modules.

Furthermore I tried a Jetbrain's Rust Rover (that does not use rust analyzer) and the IDE functions are working normally in both modules which leads me to believe the problem is not with how module2 is setup.

The real project has more than 2 modules and I cannot reproduce this problem on any module other than module2 and all modules seem more or less identical in the setup except for one difference: module 2 has a sub-crate project. Nevertheless, I tried deleting the folder of this subcrate altogether but it made no difference.

Any hints how to fix this?

For reference the module that has the problem in the project I am trying to work on src/platform/redox · master · redox-os / relibc · GitLab

In the parent module there is:

#[cfg(all(not(feature = "no_std"), target_os = "redox"))]
#[path = "redox/mod.rs"]
pub(crate) mod sys;

So the module will only be compiled, and only analyzed, if target_os = "redox".

It workss after changing it to linux :heavy_heart_exclamation: !! Thanks a lot for the hint and the quick reply

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.