Configuring rust-analyzer for an embedded rust project (no_std) #26852
Replies: 4 comments
-
I have tested things on Linux, and the same configuration appears to be working fine while it fails on a Mac. So after all it might be some bug that is causing problems here. |
Beta Was this translation helpful? Give feedback.
-
Now that I have done extra testing I am pretty sure it is a bug in zed. I have opened an issue #27637 to document this problem. As it is now an issue I think this discussion can be closed. |
Beta Was this translation helpful? Give feedback.
-
I ran into the same issue and found that the correct config key in Zed is slightly different. "lsp": {
"rust-analyzer": {
"initialization_options": {
"checkOnSave": {
"allTargets": false
}
}
}
} After adding this, the can't find crate for 'test' errors on no_std targets disappeared. Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
{
"lsp": {
"rust-analyzer": {
"initialization_options": {
"cargo": {
"target": "riscv32i-unknown-none-elf",
"allTargets": false
}
}
}
}
} This worked for me @ .zed/settings.json See https://zed.dev/docs/configuring-zed and https://zed.dev/docs/languages/rust for full documentation :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
To be able to use Zed for rust on embedded systems it is necessary to turn off the
allTargets
option, otherwise all files with the no_std setting will be plastered with therustc: can't find crate for 'test'
error.I tried to follow the documentation but the setting does not seem to do anything. The zed logfile is not verbose enough to indicate what options are used for the execution of
check
either.My workspace config is as follows:
The above does not seem to have any impact on the lsp errors.
In contrast the following config does work in vscode:
I am running Zed 0.177.9 on ARM Mac OS.
Any help would be appreciated, I would love to give Zed a chance to replace VSCode but this is a bit of a showstopper for me.
Cheers,
Piotr
Beta Was this translation helpful? Give feedback.
All reactions