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

Rust GoTo support doesn't work with standard library #1912

Closed
palango opened this issue Jan 15, 2016 · 17 comments · Fixed by ycm-core/ycmd#1224
Closed

Rust GoTo support doesn't work with standard library #1912

palango opened this issue Jan 15, 2016 · 17 comments · Fixed by ycm-core/ycmd#1224

Comments

@palango
Copy link

palango commented Jan 15, 2016

When using the rust plugin the GoTo command works fine as long as I jump in the project or the dependency crates. However, I can't follow links to the standard library. When I try this I get the following message:

Runtime Error: Can't jump to definition.

The rust sources are there and set by g:ycm_rust_src_path and completion works fine. I'm on MacVim 7.4 (88) with YCM installed today.

@vheon
Copy link
Contributor

vheon commented Jan 15, 2016

I don't know if is a limitation of racer

ping @jwilm

@jwilm
Copy link
Contributor

jwilm commented Jan 15, 2016

@palango can you please provide the output from :let g:ycm_rust_src_path in vim and maybe a stat or better yet a tree -L 1 of whatever the value is set to?

Thanks!

@palango
Copy link
Author

palango commented Jan 16, 2016

Ok, thanks for the responses. Tell me if you need anything else.

:let g:ycm_rust_src_pathreturns g:ycm_rust_src_path /Users/paul/Projects/rust/rustc-latest-src/src.

tree -L 1in the directory above gives the following, it's the rust 1.5 sources:

○ % tree -L 1                                                                               2:04:44
.
├── compiler-rt
├── compiletest
├── doc
├── driver
├── error-index-generator
├── etc
├── jemalloc
├── liballoc
├── liballoc_jemalloc
├── liballoc_system
├── libarena
├── libbacktrace
├── libcollections
├── libcollectionstest
├── libcore
├── libcoretest
├── libflate
├── libfmt_macros
├── libgetopts
├── libgraphviz
├── liblibc
├── liblog
├── librand
├── librbml
├── librustc
├── librustc_back
├── librustc_bitflags
├── librustc_borrowck
├── librustc_data_structures
├── librustc_driver
├── librustc_front
├── librustc_lint
├── librustc_llvm
├── librustc_mir
├── librustc_platform_intrinsics
├── librustc_privacy
├── librustc_resolve
├── librustc_trans
├── librustc_typeck
├── librustc_unicode
├── librustdoc
├── libserialize
├── libstd
├── libsyntax
├── libterm
├── libtest
├── llvm
├── rt
├── rust-installer
├── rustbook
├── rustllvm
├── snapshots.txt
└── test

52 directories, 1 file

@jwilm
Copy link
Contributor

jwilm commented Jan 16, 2016

While you have vim open, can you do a ps aux | grep racerd and paste that output here?

@palango
Copy link
Author

palango commented Jan 16, 2016

○ % ps aux | grep racerd                                                                    2:04:48
paul            83036   0.0  0.0  2600472   2896   ??  S     5:04PM   0:00.09 /Users/paul/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/racerd serve --port 65486 -l --secret-file /var/folders/gz/0f_3f9k96gd1hblwgd1r8h280000gn/T/tmp6175yM --rust-src-path /Users/paul/Projects/rust/rustc-latest-src/src
paul            83498   0.0  0.0  2434836    748 s000  S+    2:15AM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn racerd

@jwilm
Copy link
Contributor

jwilm commented Jan 16, 2016

Hmm. And do you have a RUST_SRC_PATH env var set?

@palango
Copy link
Author

palango commented Jan 16, 2016

@jwilm: No, it's not set.

Update: seems like that was the problem, when I set it it works fine.

@jwilm
Copy link
Contributor

jwilm commented Jan 16, 2016

@palango That's not supposed to be necessary :P. Well, I guess that's the workaround in the mean time. This is a bug in either ycmd's rust completer or racerd. Would you mind sharing your racerd/ycmd (both stdout and stderr) logs from when you had the issue? They could be useful for tracking down the issue. You might have to recreate it since ycm doesn't keep log files by default. You can get their location via :YcmDebugInfo after doing a rust completion or goto.

@jwilm
Copy link
Contributor

jwilm commented Jan 16, 2016

This also highlights the need for additional information in :YcmDebugInfo so I can just ask people to provide that in the future :).

Thanks!!!

@palango
Copy link
Author

palango commented Jan 16, 2016

Do you want the logs with the RUST_SRC_PATH set or not.
The log attached is with working completion (at least the end, in the beginning there are some exceptions):
log.txt

@jwilm
Copy link
Contributor

jwilm commented Jan 16, 2016

Without the environment variable set, please.

@palango
Copy link
Author

palango commented Jan 16, 2016

Seems to be my bad, I might have tried it on functions and/or macros.

Even with the env variable deleted it works fine for structs and traits. I understand that functions are hard to match, but macros should be doable?

@jwilm
Copy link
Contributor

jwilm commented Jan 16, 2016

Functions should be fine. There's not support in racer for macros, yet.

@palango
Copy link
Author

palango commented Jan 16, 2016

I attached a new log, this time without the env variable set.

Some strange behaviour I noticed now, in the following code. GoTo on the read_to_string function works fine, but doesn't work for find_iter.

let _ = res.read_to_string(&mut content);
let count = re.find_iter(content.as_ref()).count());

log2.txt

@jwilm
Copy link
Contributor

jwilm commented Jan 16, 2016

Awesome information. Thanks for providing all of that in addition to the initial report.

@ngortheone
Copy link

@jwilm any updates on this? I am affected by the same problem.
I am on OSX, using nvim and symptoms are the same - completion and GoTo for some things in stdlib do not work. Minimal working snippet (guess game from the book)

    let mut guess = String::new();

    io::stdin().read_line(&mut guess)
        .expect("Failed to read line");

    let guess: u32 = guess.trim().parse()
        .expect("Please type a number");

trim() and parse() are neither being autocompleted nor I am able to jump to definition with GoTo

But I can see other completions that work (trim and parse are not found in that list)
screen shot 2018-12-18 at 11 29 46 pm

I do not have g:ycm_rust_src_path set and ps aux | grep racerd shows
--rust-src-path /Users/ihorantonov/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src

@bstaletic
Copy link
Collaborator

RLS support has been merged.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants