Skip to content

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

Closed
@stianeklund

Description

@stianeklund

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions