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

Incorrect output on rustc --print sysroot #502

Open
leonardohn opened this issue Sep 8, 2020 · 4 comments
Open

Incorrect output on rustc --print sysroot #502

leonardohn opened this issue Sep 8, 2020 · 4 comments

Comments

@leonardohn
Copy link

I've been investigating the reasons for issue #498 and it turns out that rustc --print sysroot is not displaying the correct path and instead shows /usr. I don't remember exactly when it started but rust-analyzer and rls stopped working because of it, as they need to look for the component rust-src which goes inside the sysroot.

@o01eg
Copy link
Contributor

o01eg commented Sep 8, 2020

As I remember /usr is correct sysroot value. What is expected value for rust-analyzer and rls?

@leonardohn
Copy link
Author

Both look for the sources at $(rustc --print sysroot)/lib/rustlib/src/rust/src by default. However, they work fine if I set the env RUST_SRC_PATH=/usr/lib64/rust-1.46.0/rustlib/src/rust. So, perhaps sysroot is pointing to the right place and rustlib should be inside /usr/lib?

@o01eg
Copy link
Contributor

o01eg commented Sep 8, 2020

I suppose it should use something like $(rustc --print target-libdir)/../../src/rust/src

@leonardohn
Copy link
Author

It seems to be the default path both for racer (which rls depends on) and rust-analyzer.

https://github.com/racer-rust/racer/blob/bc478759f9f7f6dacd9ec26e7905dc8724740797/src/racer/util.rs#L504
https://github.com/rust-analyzer/rust-analyzer/blob/3f721683deb81c015484abd14eb67b96f39b1aff/crates/project_model/src/sysroot.rs#L134

Note: Both sources indicates that this path is going to change at version 1.47.0, according to rust-lang/rust#73265.

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

2 participants