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

Panic on primitive_docs.rs search #1131

Open
Leorii opened this issue Sep 16, 2020 · 4 comments
Open

Panic on primitive_docs.rs search #1131

Leorii opened this issue Sep 16, 2020 · 4 comments

Comments

@Leorii
Copy link

Leorii commented Sep 16, 2020

Panic occurs when typing a std module name.

Example

impl Display for MyStruct {
    fn fmt(&self, f: &mut fm

'thread 'searcher' panicked at 'Failed load file "$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/std/src/primitive_docs.rs": Os { code: 2, kind: NotFound, message:
"No such file or directory" }', $HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/racer-2.1.38/src/racer/core.rs:816:14\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\n'

Thoughts

I believe this might have something to do with #1130. The completion does still work (it attempts to find the source from the original rust directory layout), but then I think it still tries to find the source from the new layout and fails at that.

@Leorii
Copy link
Author

Leorii commented Sep 16, 2020

I think I found the source of the bug: https://github.com/racer-rust/racer/pull/1130/files#r489576403

I'm happy to submit a PR for this if anyone would like to tell me if I'm headed in the right direction here.

@Leorii Leorii changed the title Panic on std module completion Panic on primitive_docs.rs search Sep 16, 2020
@Leorii
Copy link
Author

Leorii commented Sep 16, 2020

I have a temporary fix on my system that I believe also confirms that this is the issue. I have symlinked the $RUST_SRC_PATH/libstd directory to $RUST_SRC_PATH/std/src, and that seems to work fine for now. But I would still be happy to submit a PR if this is a valid issue/concern.

If anyone else wants the temporary fix, do this:

SOURCE_DIR=$(rustc --print sysroot)/lib/rustlib/src/rust/src

mkdir $SOURCE_DIR/std
ln -s $SOURCE_DIR/libstd $SOURCE_DIR/std/src

@kngwyu
Copy link
Collaborator

kngwyu commented Sep 17, 2020

Thanks, I think you're in the right direction as I commented.

Since recently I don't have enough time to maintain this project sufficiently, PR is very welcome.

I think the PR might not be very complicated: we just have to add older locations looking #1130.

@Leorii
Copy link
Author

Leorii commented Oct 22, 2020

Whoops, forgot about this. I'd be happy to submit a PR for it :D

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