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
Error related to rust-cargo #23
Comments
When I run
When I run the same command on
Just like reported on #16. |
@carlosgaldino Would you mind to show your Flycheck and Flycheck Rust setup? |
@lunaryorn I'm using Spacemacs so the config is the following: https://github.com/syl20bnr/spacemacs/blob/v0.105.4/layers/%2Blang/rust/packages.el#L24-L32 |
@lunaryorn Sorry. I forgot to add |
Can you provide the versions of Flycheck and Flycheck Rust installed in your Emacs? And name your Rust version? |
|
@mkpankov I think I'll need your help here. Since #18 Flycheck Rust always picks the "binary" crate type if there's a I'm not sure how we could solve that. Passing |
@lunaryorn thank you for invitation to the org! 😉 I'll try to work on the issue on weekend, but unfortunately can't promise anything. |
@mkpankov You're welcome. I meant to write you a mail, but I forgot |
Ok, I've been able to reproduce the issue. This is the test project I've setup. Flycheck breaks in It's indeed the case that So, I propose adding a new variable, i.e. Another question, then, is where do we get its value from. I found {"name":"test","version":"0.1.0","dependencies":[],"targets":[{"kind":["lib"],"name":"test","src_path":"/home/mkpankov/flycheck-rust/tests/main-and-lib/test/src/lib.rs","metadata":{"metadata":"06b476a90b7dc18d","extra_filename":"-06b476a90b7dc18d"}},{"kind":["bin"],"name":"test","src_path":"/home/mkpankov/flycheck-rust/tests/main-and-lib/test/src/main.rs","metadata":null}],"manifest_path":"/home/mkpankov/flycheck-rust/tests/main-and-lib/test/Cargo.toml"} Then, we should go over the I feel I oversimplify things and proposed solution lacks generality, but well, we have to work off something. I propose digging this way first to find out how good this scheme is. @lunaryorn do you think you could take a shot at implementing this? I have nearly no time to work on |
@mkpankov I don't think so, at least any time soon. Adding an option to Flycheck is simple, but digging through the Cargo layout to guess the executable name is more than I have time for currently. Besides, I don't really use Rust in any complicated setup, and am not personally affected by this problem. My personal focus is on the many open tasks in Flycheck, particularly on writing documentation for contributors and maintainers, which is crucial to ensure that Flycheck is able to continue evolving as fast as it used to do in the past. Working on individual language support has to stand back, the more when I'm not affected personally. I'm sorry. That said, your approach sounds interesting, and I think it'll get us a huge step closer to good Rust support in complex projects. I hope that someone from the community picks this up and gives it a shot |
I think it should work up to the point where a bin file has submodules implemented in other files. For example:
// src/bin/foo.rs
extern crate my_crate;
mod common;
fn main() { } // src/bin/common.rs
pub fn some_common_thing() { } If you edit |
Any luck on this? I also have this problem. |
I am still able to reproduce this error with latest rust/cargo/emacs The exact error:
$ emacs-snapshot --version
GNU Emacs 25.1.50.2
$ rustc --version
rustc 1.11.0 (9b21dcd6a 2016-08-15)
$ cargo --version
cargo 0.12.0-nightly (6b98d1f 2016-07-04)
Steps to reproduce:
|
@djanderson Hmm I cannot reproduce under Emacs 24.5.1 or 25.1.1. I have no error when opening hello_world/src/main.rs, and introducing a syntax error and saving the file does trigger flycheck, as expected.
Same flycheck and flycheck-rust as you. |
It's not working for me either. To be honest, i don't understand why it says "no such subcommand".
But first of all, my directory structure shows no "library". I have no [lib] entry in the Cargo.toml and only one file: src/main.rs. And second of all, why does it say "no such subcommand"? Because i can run this command in the terminal and that gives the error "error: no library targets found". |
I have found that /usr/bin/cargo was an old version and that's why flycheck-rust did get "no such subcommand". |
@buster Are you using rustup? Flycheck will look for the In a rust file in your cargo project, you can use |
@fmdkdd, well, I'm embarrassed to say that I was able to fix the issue by actually RTFMing your README :) I was already using flycheck for several other languages and so just copy/pasted one and added the hook to rust-mode, but when I added |
@fmdkdd: Yes, i am using rustup. Somehow emacs didn't pick up my PATH variable. I'l' set flycheck-rust-cargo-executable.. It works now, thanks! |
@fmdkdd Does flycheck-rust have such a variable? Looking in the source i can't find a reference to it... I don't know flycheck or elisp, so i may be missing something.. |
@buster Yes, it does. Flycheck implicitly defines such a variable for all syntax checkers. Take a look at |
@djanderson Glad to know it's working for you now :) @buster @lunaryorn Implicitly defined variables always trip me up too, since jumping to definition from the help buffer does not work. Even though the docstring does tell its purpose, it also states that the value is "nil", but then at the end of the docstring actually tells you the default is "cargo". Still, it's good that we can override the executable for every checker, as in this case it proves useful. Looking at the manual at http://www.flycheck.org, it seems this functionality is only referenced in the first screenshot of the 'Quickstart' section, in the flycheck menu. The menu is very good for discoverability, but I wonder how many users toggle them off... (I know I do). |
@fmdkdd Would you rather define this variable explicitly for each of the 80 syntax checkers we support? I'm aware that this part of Flycheck isn't documented in the manual, see flycheck/flycheck#927: Configuration of checkers is still missing. I'll add it at some point but given that it's got a docstring, is referred to in the docstring of each syntax checker and an option that's probably not of so much use (you'll more likely change I'm not actually sure whether the variable is really the place to go in this case. Assuming that @buster is on OS X a proper |
@lunaryorn It's a tradeoff. I'd rather have Emacs tell me it's a custom variable defined by a macro, at least. Good to know that documentation is coming. Let me know if I can help in any capability. |
@fmdkdd Any contribution to the documentation would be very welcome :) I've been planning to write more for a long time, but then I thought it'd be more important to provide good documentation for new contributors which is why I spent most of my documentation efforts on the contributor and maintainer guide and automated a lot of our processes (like releases, etc.). I'm not sure in how far we can bent Emacs to improve the docstrings and the "source discoverability" of these variables. When I chose to auto-generate the definitions it was because I didn't want to write those definitions for 80 checkers—I didn't care much about documentation. Maybe we can find a better way to handle these definitions. If you'd like please open a new issue in the main tracker so that we can discuss possible improvements. |
Hello, not sure it's related, I get a slightly different error when compiling an
I can reproduce running the cmd manually:
Currently running on:
I'm starting now with Rust, but it is my understanding that the Thanks for any hint! |
@apiraino Yes, |
I believe this is related to #16 and #18. I'm using the latest version from Dec 25 and getting this message when I save any file on my project. The project layout is:
Any ideas about this? Is there something I'm doing wrong?
Thank you.
The text was updated successfully, but these errors were encountered: