clap: 3.0.0 beta: proc-macro derive panicked
Rust Version
rustc 1.38.0 (625451e37 2019-09-23)
Affected Version of clap
[[package]]
name = "clap"
version = "3.0.0-beta.1"
source = "git+https://github.com/clap-rs/clap#b8819130de876c4abbd451c34df89161a98d23ef"
Expected Behavior Summary
#[derive(Clap, Debug)]
and #[clap()]
macros should work
Actual Behavior Summary
proc-macro derive panicked
. Screenshots help here for showing how it varies when commenting out macros; it seems to fail in different ones too.


Steps to Reproduce the issue
- Use
clap
from git master - Follow the instructions in readme; use
#[derive(Clap, Debug)]
and#[clap()]
macros - Observe compile errors from
rustc
Sample Code or Link to Sample Code
Tiny pet project pull request here for upgrading to clap
3.0.0 here, with a very minimal reproduction of the issue: https://github.com/Walther/wordcrab/pull/1
Debug output
Debug Output
cargo build --verbose
Fresh unicode-xid v0.1.0
Fresh unicode-width v0.1.6
Fresh strsim v0.9.2
Fresh indexmap v1.2.0
Fresh ansi_term v0.11.0
Fresh vec_map v0.8.1
Fresh itoa v0.4.4
Fresh textwrap v0.11.0
Fresh proc-macro2 v0.4.30
Fresh libc v0.2.64
Fresh bitflags v1.2.1
Fresh ryu v1.0.2
Fresh serde v1.0.101
Fresh quote v0.6.13
Fresh atty v0.2.13
Fresh serde_json v1.0.41
Fresh syn v0.15.44
Fresh clap_derive v0.3.0 (https://github.com/clap-rs/clap_derive#4a46684b)
Fresh clap v3.0.0-beta.1 (https://github.com/clap-rs/clap#b8819130)
Compiling wordcrab v0.2.1 (/Users/veeti/git/wordcrab)
Running rustc --edition=2018 --crate-name wordcrab src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=94f2349a0e5cbdc7 -C extra-filename=-94f2349a0e5cbdc7 --out-dir /Users/veeti/git/wordcrab/target/debug/deps -C incremental=/Users/veeti/git/wordcrab/target/debug/incremental -L dependency=/Users/veeti/git/wordcrab/target/debug/deps --extern clap=/Users/veeti/git/wordcrab/target/debug/deps/libclap-5caa4c477358f1f8.rlib --extern serde=/Users/veeti/git/wordcrab/target/debug/deps/libserde-e483c8ba7a1e6576.rlib --extern serde_json=/Users/veeti/git/wordcrab/target/debug/deps/libserde_json-098c2405408937ce.rlib
error: proc-macro derive panicked
–> src/main.rs:9:10
|
9 | #[derive(Clap, Debug)]
| ^^^^
|
= help: message: unsupported option: short
error: aborting due to previous error
error: Could not compile wordcrab
.
Caused by:
process didn’t exit successfully: rustc --edition=2018 --crate-name wordcrab src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=94f2349a0e5cbdc7 -C extra-filename=-94f2349a0e5cbdc7 --out-dir /Users/veeti/git/wordcrab/target/debug/deps -C incremental=/Users/veeti/git/wordcrab/target/debug/incremental -L dependency=/Users/veeti/git/wordcrab/target/debug/deps --extern clap=/Users/veeti/git/wordcrab/target/debug/deps/libclap-5caa4c477358f1f8.rlib --extern serde=/Users/veeti/git/wordcrab/target/debug/deps/libserde-e483c8ba7a1e6576.rlib --extern serde_json=/Users/veeti/git/wordcrab/target/debug/deps/libserde_json-098c2405408937ce.rlib
(exit code: 1)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (15 by maintainers)
This is done in
structopt v0.3
as one of the new features I was talking about. That’s why I’m trying to encourage people to move for v0.3 - most of the asked improvements are already done in the new structopt.If you think that some error message in
structopt
isn’t clear enough or points to a wrong location - please file an issue.IMHO: the ideal result would be merging the latest
structopt
intoclap_derive
and deprecatingstructopt
entirely.The macros are declared in clap_derive crate so you can check there