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

Getting "can't find crate for ..." with Syntastic #130

Closed
lesurp opened this issue Dec 8, 2016 · 10 comments
Closed

Getting "can't find crate for ..." with Syntastic #130

lesurp opened this issue Dec 8, 2016 · 10 comments

Comments

@lesurp
Copy link

lesurp commented Dec 8, 2016

Hi, using syntastic with this plugin will give me the error "can't find crate for" although the crate is found properly by cargo (program compiles just fine).
This might be a syntastic configuration problem, but no mention is made in this repo about any configuration to do so here I am.

@brycefisher
Copy link

brycefisher commented Dec 10, 2016

Same issue for me when using Neovim + Neomake.

$ rustc --version
rustc 1.13.0 (2c6933acc 2016-11-07)
$ cargo --version
cargo 0.13.0-nightly (eca9e15 2016-11-01)
$ nvim --version
NVIM 0.2.0-dev
....

steps to repro:

  1. Install neovim
  2. Install neomake
  3. Install rust.vim
  4. Add let g:rustfmt_autosave = 1 to my ~/.config/nvim/init.vim (aka .vimrc)
  5. cargo new --bin repro && echo 'extern crate serde;' > repro/src/main.src && cargo build
  6. Open main.rs in nvim and try to save the file.

@mckinnsb
Copy link

mckinnsb commented Dec 12, 2016

I am also getting this issue, using vim and pathogen.

@yyyar
Copy link

yyyar commented Dec 16, 2016

I have the same issue with vim and vundle, anyone found a solution?

@mckinnsb
Copy link

mckinnsb commented Dec 16, 2016

@yyyar try my fork of rust.vim for now. It builds a new syntax checker for rust using cargo that runs "cargo build" in the directory of the file. It's a little slow the first time because it has to compile, but it works for now.

From what I understand, rustc removed the -Z --no-trans flag, which was what the old checker was using.The checker on master now just runs "rustc {file}". This was done to keep rust.vim fast, but with the new changes to cargo check coming in the future, we can now run "cargo check" in the directory, and this should be almost as fast because cargo check no longer compiles ( you can read about that here ):

https://www.reddit.com/r/rust/comments/5ibr2a/cargo_check_has_been_merged_into_cargo_directly/

So you can take my fork, or try to build a new syntax checker using cargo check. rust.vim might get a PR or update fixing this soon, but I'm not sure when that would get merged into master.

@estin
Copy link

estin commented Mar 1, 2017

While awaiting PR #132
Overriding rustc checker options works for me.

let g:syntastic_rust_rustc_exe = 'cargo check'
let g:syntastic_rust_rustc_fname = ''
let g:syntastic_rust_rustc_args = '--'
let g:syntastic_rust_checkers = ['rustc']
" let g:syntastic_debug = 1
" let g:syntastic_debug_file = "~/syntastic.log" 

By this settings would be used cargo check -- on whole project (not for current file)

@brycefisher
Copy link

FYI @bobzoller

@camdencheek
Copy link

Update: Rust stable branch now includes cargo check

@timbess
Copy link

timbess commented Sep 1, 2017

Looks like it was fixed, but just to update this ticket, adding this line to your vimrc will fix it
let g:syntastic_rust_checkers = ['cargo']

@mitchmindtree
Copy link

FWIW I also had to update the syntastic plugin itself - just thought I'd add a friendly reminder!

@da-x
Copy link
Member

da-x commented Jul 1, 2018

Hi all,

After various fixes to rust.vim, there is no longer the need to specify g:syntastic_rust_checkers = ['cargo'], it's now default and should just work out of the box. There were also fixes to the checker itself (for example, 'current directory' sensitivity issues).

At last, this old issue should be done!

@da-x da-x closed this as completed Jul 1, 2018
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

9 participants