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

Syntax checker doesn't work #33

Closed
andriykohut opened this issue May 28, 2015 · 4 comments
Closed

Syntax checker doesn't work #33

andriykohut opened this issue May 28, 2015 · 4 comments

Comments

@andriykohut
Copy link

I have syntastic installed, it works for other filetypes. Can't get it to work with this plugin. I don't get any errors, it just doesn't work.

Here's example:

fn main() {
    let x: i32 = "test";
}

When I'm trying to compile, I get:

test.rs:2:18: 2:24 error: mismatched types:
 expected `i32`,
    found `&'static str`
(expected i32,
    found &-ptr) [E0308]
test.rs:2     let x: i32 = "test";
                           ^~~~~~
error: aborting due to previous error

Saving file or running :SyntasticCheck doesn't do anything.

Here's :SyntasticInfo output:

Syntastic version: 3.6.0-86 (Vim 704, Darwin)
Info for filetype: rust
Global mode: active
Filetype rust is active
The current file will be checked automatically
Available checker: rustc
Currently enabled checker: rustc
@andriykohut andriykohut changed the title Syntax checker not woring Syntax checker doesn't work May 28, 2015
@zkanda
Copy link

zkanda commented Jun 4, 2015

Same here. Not sure how to debug this though. :)

@chris-morgan
Copy link
Member

The syntastic syntax checker uses -Z parse-only, only performing parsing and no more. Introduce a syntax error and it will be glad to yell at you. This was done for a couple of reasons:

  • Doing actual compilation (even with -Z no-trans which basically means “prove it will compile, but don’t actually compile it) is slow; often, really slow.
  • Syntastic is used to handling executing things like foo % (where % is the filename); for Rust, that will rarely give the desired result—only for crate root files will it. Files other than the crate root file will regularly fail to compile where they would compile fine as part of the whole crate. Figuring out where and what the crate root is (necessary for better compiler/makeprg support, frankly) is not the simplest of tasks and nothing has been done about it.

@andriykohut
Copy link
Author

Ah, makes sense. Thanks for clarifying then. Should I close this?

@wingerse
Copy link

I think this should be added to the README. I thought I did something wrong and installed syntastic and rust vim twice only to find out this page later.

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

4 participants