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

Flycheck-rust just says "aborting due to 3 previous errors" #48

Closed
TyOverby opened this issue Jan 5, 2017 · 9 comments
Closed

Flycheck-rust just says "aborting due to 3 previous errors" #48

TyOverby opened this issue Jan 5, 2017 · 9 comments

Comments

@TyOverby
Copy link

TyOverby commented Jan 5, 2017

There's no actual mention of what the errors are.

This is on a project that builds without issue with cargo build

screen shot 2017-01-05 at 8 04 39 am

@fmdkdd
Copy link
Member

fmdkdd commented Jan 5, 2017

That's a terribly unhelpful error message. Sorry for that. Can you give me the output of flycheck-compile (C-c ! C-c) for rust-cargo on this file?

@TyOverby
Copy link
Author

TyOverby commented Jan 5, 2017

cargo rustc --lib -- -Z no-trans -Z unstable-options --error-format\=json --test -L/Users/tyoverby/workspace/rust/implicit-gpu/target/debug -L/Users/tyoverby/workspace/rust/implicit-gpu/target/debug/deps
   Compiling implicit-gpu v0.1.0 (file:///Users/tyoverby/workspace/rust/implicit-gpu)
{"message":"no method named `input_buffer` found for type `&opencl::OpenClContext` in the current scope","code":null,"level":"error","spans":[{"file_name":"src/marching/mod.rs","byte_start":22827,"byte_end":22839,"line_start":67,"line_end":67,"column_start":23,"column_end":35,"is_primary":true,"text":[{"text":"        let buf = ctx.input_buffer([2, 2], &[a, b, d, c]);","highlight_start":23,"highlight_end":35}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}
{"message":"no method named `len` found for type `opencl::buffers::LineBuffer` in the current scope","code":null,"level":"error","spans":[{"file_name":"src/marching/mod.rs","byte_start":22962,"byte_end":22965,"line_start":70,"line_end":70,"column_start":46,"column_end":49,"is_primary":true,"text":[{"text":"        let mut out = vec![0.0 / 0.0; result.len()];","highlight_start":46,"highlight_end":49}],"label":null,"suggested_replacement":null,"expansion":{"span":{"file_name":"src/marching/mod.rs","byte_start":22939,"byte_end":22968,"line_start":70,"line_end":70,"column_start":23,"column_end":52,"is_primary":false,"text":[{"text":"        let mut out = vec![0.0 / 0.0; result.len()];","highlight_start":23,"highlight_end":52}],"label":null,"suggested_replacement":null,"expansion":null},"macro_decl_name":"vec!","def_site_span":{"file_name":"<vec macros>","byte_start":64999,"byte_end":65221,"line_start":1,"line_end":4,"column_start":1,"column_end":31,"is_primary":false,"text":[{"text":"( $ elem : expr ; $ n : expr ) => (","highlight_start":1,"highlight_end":36},{"text":"$ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => (","highlight_start":1,"highlight_end":79},{"text":"< [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * )","highlight_start":1,"highlight_end":77},{"text":"=> ( vec ! [ $ ( $ x ) , * ] )","highlight_start":1,"highlight_end":31}],"label":null,"suggested_replacement":null,"expansion":null}}}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope; the following traits define an item `len`, perhaps you need to implement one of them:","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"candidate #1: `std::iter::ExactSizeIterator`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"candidate #2: `core::slice::SliceExt`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"candidate #3: `core::str::StrExt`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"candidate #4: `rayon::par_iter::ExactParallelIterator`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":null}
{"message":"no method named `read` found for type `opencl::buffers::LineBuffer` in the current scope","code":null,"level":"error","spans":[{"file_name":"src/marching/mod.rs","byte_start":22985,"byte_end":22989,"line_start":71,"line_end":71,"column_start":16,"column_end":20,"is_primary":true,"text":[{"text":"        result.read(&mut out).enq().unwrap();","highlight_start":16,"highlight_end":20}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[{"message":"items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `read`, perhaps you need to implement it:","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"candidate #1: `std::io::Read`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":null}
{"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":null}

Interesting that it does give the other errors that it found, but it's even more odd that those "errors" don't show up in my actual build.

@TyOverby
Copy link
Author

TyOverby commented Jan 5, 2017

Is there a way that I can see what version of rustc it's using?

In my terminal, I run the command that it gave me

cargo rustc --lib -- -Z no-trans -Z unstable-options --error-format\=json --test -L/Users/tyoverby/workspace/rust/implicit-gpu/target/debug -L/Users/tyoverby/workspace/rust/implicit-gpu/target/debug/deps

and I do get the same errors on the terminal, so it's not a mismatched rustc version.

@TyOverby
Copy link
Author

TyOverby commented Jan 5, 2017

Notice how the invocation of cargo build is fine, but the invocation of cargo rustc breaks in the same way that flycheck-compile does.

screen shot 2017-01-05 at 8 38 21 am

@fmdkdd
Copy link
Member

fmdkdd commented Jan 5, 2017

Thanks, I can indeed reproduce by cloning your repo. Looking into it.

@TyOverby
Copy link
Author

TyOverby commented Jan 5, 2017

I think I know what's going on, and this is probably not a bug in flycheck-rust, it's just that I didn't understand how flycheck works...

  1. I thought that flycheck-list-errors would list all the errors for my whole project. This is apparently not the default behavior, and it shows only errors for the current file (or global errors)
  2. Those compilation errors are real but they're in a #[test] method which isn't built during cargo build but is built during cargo rustc --test
  3. flycheck-rust will always show that the build failed on every file, leading me to believe that the other errors were getting swallowed (when in fact, they were just being hidden because I didn't have the correct file open).

@fmdkdd
Copy link
Member

fmdkdd commented Jan 5, 2017

Ah, you beat me to it.

Point 1 has actually been brought up before. There was a PR flycheck/flycheck#972, but progress has stalled for various reasons.

Point 3 is actually an unwanted side-effect of fixing flycheck/flycheck#1182. The message "aborting due to 3 previous errors" should be filtered out by flycheck, and flycheck/flycheck#1187 should take care of it. I notice that my fix was incomplete, so thanks for your report :)

@TyOverby
Copy link
Author

TyOverby commented Jan 5, 2017

@fmdkdd Would you be willing to mentor me as I attempt to add project-wide error messages to flycheck? I'm really new to emacs lisp and it looks like you know your way around flycheck + flycheck-rust!

Unfortunately flycheck is basically worthless for me until it has project-wide error messages, so I'm going to try and add it myself 😄

@fmdkdd
Copy link
Member

fmdkdd commented Jan 6, 2017

@TyOverby That's actually a feature that I would like to see implemented as well. From a cursory reading of the PR discussion, it does not look like an easy task to complete. But, that PR in its current state may be a good place to start.

I don't know flycheck inside-out, but I can follow the lisp. I'll be happy to help you out, but expect more than a few bumps in the road before we manage to work out all the corner cases :)

Open up a PR on flycheck/flycheck proper. I think the approach taken in flycheck/flycheck#972 is sound and was already approved. It just needs polishing up. You can pick up that branch to open your PR.

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