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

False positive error can't find crate for test despite check.allTargets unset #14155

Closed
widlarizer opened this issue Feb 15, 2023 · 1 comment · Fixed by #14912
Closed

False positive error can't find crate for test despite check.allTargets unset #14155

widlarizer opened this issue Feb 15, 2023 · 1 comment · Fixed by #14912
Labels
A-config configuration C-bug Category: bug

Comments

@widlarizer
Copy link

"rust-analyzer.check.allTargets": false is insufficient to avoid error[E0463]: can't find crate for `test` in a no_std project with a custom build of the Rust toolchain.

  • rust-analyzer 1.67.0-dev (72d0f607166 2023-02-08)
  • same version cargo and rustc
  • VS Code extension installed from official version rust-lang.rust-analyzer-0.4.1404@linux-x64.vsix

Please suggest additional information that I could provide. cargo check works just fine with this custom toolchain, so the extension must be calling cargo test or something similar, which is why I tried setting rust-analyzer.check.allTargets to false as per #11982

@tgiannak
Copy link

I ran into the same problem in a no_std project. Searching for --all-targets shows

cargo_args: vec![
cmd.to_string(),
"--package".to_string(),
spec.package.clone(),
"--all-targets".to_string(),
],
in the code which includes --all-targets in an invocation to cargo check without consulting the setting.

The code for FlyCheck does respect the setting:

if *all_targets {
cmd.arg("--all-targets");
}

This spot also doesn't respect the setting, but I can't tell if it is related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-config configuration C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants