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

non-compatible racer binary with RUST_SRC_PATH #408

Open
ernestrc opened this issue Oct 5, 2015 · 6 comments
Open

non-compatible racer binary with RUST_SRC_PATH #408

ernestrc opened this issue Oct 5, 2015 · 6 comments

Comments

@ernestrc
Copy link

ernestrc commented Oct 5, 2015

I've started using multirust and suddently racer stopped working for non std completions or go to definitions. I think we should add a warning in the installation instructions about racer-binary/rust-src-path and potentially get racer to throw a warning as well. When invoked from the CLI, it would exit with status 0 in any case.

Any ideas how can we make this incompatibility issue more transparent to consumers of racer?

@phildawes
Copy link
Collaborator

racer should work with multirust (that's how I use it). Which versions of everything are you using?
(thanks!)

@ernestrc
Copy link
Author

ernestrc commented Oct 5, 2015

multirust 0.7.0 (b222fcd27 2015-09-24 10:53:38 -0700)
rustc 1.5.0-nightly (130851e03 2015-10-03)
cargo 0.6.0-nightly (7f21e73 2015-10-01)
racer compiled with cargo in las commit (b9750c3)
vim-racer in last commit (dde0d9b557a75858099fd4b873d4a1ed2dfc3111)
arch-linux (also tried on my OSX, same results)

So what I do is use this gist and symlink the nightly toolchain src folder to /usr/local/src/rust/src.

I just realized that I can use go-to-definition only on use std::<mod> or on extern crate <lib1>, on top of the <lib> word. If I try to use it inside one of the nested modules, say for example in use <lib1>, it doesn't work. Is this expected?

To be more specific, I can point you to the repo I'm working on: https://github.com/ernestrc/lbd . If you check it out and open the file src/model/job.rs, using vim-racer, If you try to go-to-definition on top of "fmt" in line 15, it works fine. On the other hand, when I try with "toml" in line 17, it doesn't find anything. If you go to the file src/lbdd.rs and try to do the same on top of "toml" in line 9, it will work. Is there a logical explanation for this?

Thanks mate!

@phildawes
Copy link
Collaborator

I think it's because racer doesn't support the cargo '[[bin]]' field yet, so it is not finding src/lbdd.rs as the crate root. I'll add an enhancement issue for this

@phildawes
Copy link
Collaborator

created #409

@ernestrc
Copy link
Author

ernestrc commented Oct 6, 2015

Brilliant! Thanks for all the work you've done with Racer, it's going to be an important piece in the future of Rust. Do you think #409 it's doable for a newcomer to the code base?

@phildawes
Copy link
Collaborator

Yes, I think it might be. Is quite an isolated piece of work

  • add function to cargo.rs to locate the root modules from the cargo.toml
  • hook it up to find_possible_crate_root_modules() in nameres.rs

Unfortunately that second function assumes there's only one root in a crate. It might work returning both roots though.

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