-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
When developing in rust-lang/rust and using the recommended configuration https://github.com/rust-lang/rust/blob/398fa2187c88de46c13c142f600064483a563c86/src/etc/rust_analyzer_settings.json, libtest
(e.g. library/test
cannot resolve symbols which come from libstd/libcore/liballoc (here's a totally superfluous screenshot -- that's the color used for symbol which don't resolve in my theme).
Additionally, it seems that crates libtest
depends on via Cargo.toml (like getopts
), also fail to be resolved. Notably, R-A is able to resolve symbols which come from inside libtest
itself (just basically nothing else).
I discovered1 that it can be fixed by changing "rust-analyzer.cargo.sysrootSrc": "./library"
to "rust-analyzer.cargo.sysroot": "./library"
, however this causes the crates under compiler/*
to fail to resolve their stdlib symbols in a similar2 manner to libtest
without that change.
At the moment, I switch between these configurations depending on what I'm editing (almost always using the default config, unless I need to edit libtest
), which is annoying, but not that big of a deal for me. Still, the "fix" for libtest
is extremely non-obvious, so it'd be worth fixing (and failing that, documenting this issue).
CC @jyn514 who indicated they have the same issue (but had not noticed).
I'm on nightly rust, latest rust-lang/rust master, nightly rust-analyzer, vscode insider edition, and generally the full suite of bleeding edge nonsense (I can provide precise versions if it would help, but all signs point to this being a current issue).
Footnotes
-
I think this used to be the way we used to configure it? Something like that anyway. Far enough back, I think this configuration worked for both? But maybe not -- I don't do a lot of
compiler/*
dev. ↩ -
Although unlike
libtest
, compiler crates in this configuration can resolve symbols which come from dependencies from Cargo.toml -- for example,rustc_log
resolves symbols fromtracing
just fine. I do not know if this is a useful datapoint (it certainly does not make editing this code much easier), but who knows. ↩