Skip to content

#![no_std] can't find crate for test #3297

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
imjasonmiller opened this issue Feb 24, 2020 · 4 comments
Closed

#![no_std] can't find crate for test #3297

imjasonmiller opened this issue Feb 24, 2020 · 4 comments

Comments

@imjasonmiller
Copy link

I'm posting this for posterity's sake, as someone else might run into the issue and find it useful.

I kept receiving the following error:

image

It seems it's related to the following issues:

As coc.nvim offers per project based settings, I added the following configuration and relevant target to my project, which will make the error go away:

.vim/coc-settings.json

{
  "rust.target": "thumbv7em-none-eabihf",
  "rust.all_targets": false
}

System information

nvim v0.5.0-392-gff1730373
coc-rust-analyzer 0.4.3
rustc 1.41.0 (5e1a79984 2020-01-27)
rust-analyzer cba3c99
@stenpeeters
Copy link

I observed the same issue in Eclipse while using the Corrosion plugin with rust-analyzer. For embedded code, with the #![no-std] attribute, Eclipse would always show the "can't find crate for 'test'" error.

I solved the problem by creating a json file with the following content:
./rls.json

{
"checkOnSave": {
"allTargets": false
}
}

Then in Eclipse, go to Window-> Preferences --> Rust

and add the file path to the "LS configuration" field. This assumes that the Language server is properly configured.

@pooladkhay
Copy link

Fix for VSCode:
{PROJECT_DIR}/.vscode/settings.json:

{
   "rust-analyzer.checkOnSave.allTargets": false,
}

@tomasApo
Copy link

@pooladkhay this also fixed my issue. I had a #![no_std] test crate issue for months on VSCODE. Thank you

@mlavacca
Copy link

With the rust-analyzer VSCode plugin's latest version (v0.3), the fix is:

{
   "rust-analyzer.check.allTargets": false,
}

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

5 participants