Skip to content
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

RustRover cannot found rustc-related dependency #10881

Open
WeiTheShinobi opened this issue Jan 22, 2024 · 3 comments
Open

RustRover cannot found rustc-related dependency #10881

WeiTheShinobi opened this issue Jan 22, 2024 · 3 comments

Comments

@WeiTheShinobi
Copy link

WeiTheShinobi commented Jan 22, 2024

some projects need to use rustc-related dependency (like rust-lang/clippy)
but RustRover cannot find them
I have two choices:

  1. do nothing. can compile
  2. add
    rustc_xxx = {path = ".../rust/complie/..."} at Cargo.toml
    can make RustRover find them
    but will lose the env variable
    cannot compile

So I want to ask:
Is there any ticky method I can use to make RustRover find dependencies and compile them successfully?

someone says add dependency at
[target.'cfg(NOT_A_PLATFORM)'.dependencies]
can work.
I tried and its not working

now my solution is using VSCode + rust-analyzer in this project. it worked well.

@fan-tom
Copy link
Contributor

fan-tom commented Jan 27, 2024

someone says add dependency at
[target.'cfg(NOT_A_PLATFORM)'.dependencies]
can work.

It used to work in now-deprecated idea plugin, but currently it doesn't work there either

@fan-tom
Copy link
Contributor

fan-tom commented Jan 27, 2024

My current approach is to

  1. Declare rustc deps under [target.'cfg(unix)'.dependencies] (I'm on macos so this target section is taken into account when IDEA imports the project)
  2. "Refresh Cargo Projects". Adter that IDEA resolves imports, but Cargo wouldn't build my project as it tries to build rustc crates also, which cannot succeed
  3. Change target from unix to NOT_A_PLATFORM in [target.'cfg(unix)'.dependencies], and don't reimport the project. This way Cargo is be able to build AND IDEA is able to resolve imports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants