You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have one, I'll share it when I get back to the keyboard.On 16 Apr 2021 5:53 pm, Adam Bratschi-Kaye ***@***.***> wrote:
Has anyone gotten rust-analyzer configuration that works for rust-for-linux? Could be useful to add to the documentation.
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.
Rust-for-linux doesn't use cargo and as such rust-analyzer can't automatically detect the crate roots and dependencies. Instead it is necessary to manually specify it in a rust-project.json file. rust-project.json needs to be either in the project root or be linked to using rust-analyzer.linkedProjects in the vscode configuration. See https://rust-analyzer.github.io/manual.html#non-cargo-based-projects for more documentation.
Activity
wedsonaf commentedon Apr 16, 2021
bjorn3 commentedon Apr 16, 2021
Rust-for-linux doesn't use cargo and as such rust-analyzer can't automatically detect the crate roots and dependencies. Instead it is necessary to manually specify it in a
rust-project.jsonfile.rust-project.jsonneeds to be either in the project root or be linked to usingrust-analyzer.linkedProjectsin the vscode configuration. See https://rust-analyzer.github.io/manual.html#non-cargo-based-projects for more documentation.adamrk commentedon Apr 16, 2021
Thanks!
wedsonaf commentedon Apr 19, 2021
Here's my
rust-project.json, it lives in the top directory of tree. You'll need to updatesysroot_srcto point to the appropriate one on your system.{ "sysroot_src": "/usr/local/google/home/wedsonaf/.rustup/toolchains/nightly-2021-02-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/", "crates": [ { "root_module": "rust/module.rs", "edition": "2018", "deps": [ ] }, { "root_module": "rust/kernel/lib.rs", "edition": "2018", "deps": [ { "crate": 0, "name": "module" } ] }, { "root_module": "drivers/android/rust_binder.rs", "edition": "2018", "deps": [ { "crate": 0, "name": "module" }, { "crate": 1, "name": "kernel" } ] } ] }ojeda commentedon May 8, 2021
Closed via #227.