Skip to content

intellij-rust uses cargo --all-targets by default causing: error[E0463]: can't find crate for test #5211

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

Closed
stianeklund opened this issue Apr 8, 2020 · 2 comments
Assignees

Comments

@stianeklund
Copy link

stianeklund commented Apr 8, 2020

Environment

  • IntelliJ Rust plugin version: 0.2.119.2172-193
  • Rust toolchain version: nightly-x86_64-pc-windows-gnu (1.44.0)
  • IDE name and version: CLion 2019.3
  • Operating system:Windows 10 1909 x64

Problem description

The problem is that Intelij Rust invokes cargo with all-targets which doesn't work well for certain targets. Building the project manually with cargo build from the command line works just fine.

Somewhat related issues:

Ref:

   Compiling blinky v0.1.0 (D:\dev\projects\blinky)
error[E0463]: can't find crate for `test`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `blinky`.

To learn more, run the command again with --verbose.

Steps to reproduce

  1. Have nightly-x86_64-pc-windows-gnu toolchain installed (ref rustc 1.44.0-nightly (6dee5f112 2020-04-06))
  2. Install target thumbv7em-none-eabihf.
  3. Create directory .cargo and config file in subdirectory.

The config file in this case specifies the target (see below):

.cargo/config's contents:

[target.thumbv7em-none-eabihf]
rustflags = [
  "-C", "link-arg=-Tlink.x",
]

[build]
target = "thumbv7em-none-eabihf"
  1. Use main.rs and cargo.toml contents from: https://gist.github.com/stianeklund/7965a4533f99bda2a7a92ab67b0baa56

Project was created from following steps at: https://github.com/stm32-rs/stm32f4xx-hal

@stianeklund stianeklund changed the title error[E0463]: can't find crate for test intellij-rust uses cargo --all-targets by default causing: error[E0463]: can't find crate for test Apr 8, 2020
@mchernyavsky mchernyavsky self-assigned this Apr 8, 2020
@mchernyavsky
Copy link
Member

Hello.

Try to disable the Compile all project targets if possible option in Preferences > Languages & Frameworks > Rust > Cargo.

image

@stianeklund
Copy link
Author

@mchernyavsky Thanks I tested this but it seems maybe that the build process hangs when I do this, however after updating to the latest nightly this issue no longer seems to be a problem.

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

2 participants