Skip to content

Error for extern crate #12

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

Closed
xuzhao9 opened this issue Jun 9, 2015 · 10 comments
Closed

Error for extern crate #12

xuzhao9 opened this issue Jun 9, 2015 · 10 comments
Labels

Comments

@xuzhao9
Copy link

xuzhao9 commented Jun 9, 2015

For example following code snippet:

extern crate regex;   // on this line flycheck has error 'can't find crate for 'regex''
fn main() {
}

Actually I have already setup regex crate in Cargo.toml, dependencies section.
Is there a way to prevent flycheck-rust stop checking extern crate related lines?

@swsnr
Copy link
Contributor

swsnr commented Jun 9, 2015

@NUK9 Did you run cargo build? Does the library exist in target/debug/deps/?

@mkpankov
Copy link
Contributor

mkpankov commented Jun 9, 2015

Last time I stumbled upon this, this was especially a ptoblem with crates, that are bundled with rustc. For example, using term from crates.io would emit "can't find crate; multiple candidates" error on extern crate term.

This was due to direct launch of rustc, as opposed to cargo running rustc, which supplies additional options to define proper dependencies paths.

Also, AFAIK, cargo rustc command was implemented - does flycheck-rust use it now or not yet?

@swsnr
Copy link
Contributor

swsnr commented Jun 9, 2015

@mkpankov Uhm, we obviously have a different error here… I appreciate your input, but please let us focus on solving this specific issue to help @NUK9 instead of discussing the general approach of how we check Rust code in Flycheck. Thanks you.

See #8 for ideas on how to use Cargo instead.

@xuzhao9
Copy link
Author

xuzhao9 commented Jun 9, 2015

I found out the reason: I need to run flycheck-rust-setup. Running that function solved this problem.

@xuzhao9 xuzhao9 closed this as completed Jun 9, 2015
@swsnr
Copy link
Contributor

swsnr commented Jun 9, 2015

@NUK9 Uhm, that's actually part of the installation instructions. Were these instructions somehow unclear to you?

@xuzhao9
Copy link
Author

xuzhao9 commented Jun 9, 2015

@lunaryorn Sorry I didn't visit github page, just installed the package from MELPA and I'm new to flycheck. Seems this init style also applies to other flycheck modes (e.g. flycheck-haskell) so I suggest it is my problem.

@swsnr swsnr added invalid and removed needs-input labels Jun 9, 2015
@swsnr
Copy link
Contributor

swsnr commented Jun 9, 2015

@NUK9 Please try to read the documentation of new packages in future.

@tomjakubowski
Copy link

@NUK9 just in case you don't know, from M-x package-list-packages, you can select a package and hit ? to see information about it. Many packages include a brief README-like description, and all MELPA packages at least should have an HTTP link to a package homepage where there's often usage documentation.

You can also see this information for an installed package with C-h P (capitalized P).

@xuzhao9
Copy link
Author

xuzhao9 commented Jun 9, 2015

@tomjakubowski Thank you! I will carefully read the documentation before firing an issue on github next time.

@swsnr
Copy link
Contributor

swsnr commented Jun 9, 2015

@NUK9 I've improved the commentary of Flycheck and Flycheck Rust a bit to make things more clear, hopefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants