Skip to content

Compiler error due to structopt attributes #125

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
fpoli opened this issue Jul 18, 2018 · 3 comments
Closed

Compiler error due to structopt attributes #125

fpoli opened this issue Jul 18, 2018 · 3 comments

Comments

@fpoli
Copy link

fpoli commented Jul 18, 2018

The latest nightly Rust generates an error when using #[structopt(..)] arguments:

error[E0658]: The attribute `structopt` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
  --> src/cli.rs:27:5
   |
27 |     #[structopt(long = "graphviz_file")]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: add #![feature(custom_attribute)] to the crate attributes to enable

See https://travis-ci.org/rust-lang-nursery/polonius/builds/405315425 for a full example.

It would be useful to mention in the readme the #![feature(custom_attribute)].

@TeXitoi
Copy link
Owner

TeXitoi commented Jul 18, 2018

Looking at the problem, the bad hint is tracked in rust-lang/rust#52469

I can't find a #[macro_use] before your extern crate structopt in polonius, and I suspect that's the problem, because the first error is

error: cannot find derive macro `StructOpt` in this scope
  --> src/cli.rs:11:10
   |
11 | #[derive(StructOpt, Debug)]
   |          ^^^^^^^^^

I suspect you must add #[macro_use] here: https://github.com/rust-lang-nursery/polonius/blob/master/src/lib.rs#L15

Does it fix your problem?

@TeXitoi
Copy link
Owner

TeXitoi commented Jul 18, 2018

Strange that it worked before, maybe proc_macro feature was lazy on importing the macro?

@fpoli
Copy link
Author

fpoli commented Jul 19, 2018

Adding #[macro_use] fixes the issue, thanks!

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