-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
derive(Subcommand) does not respect attributes on fields of enum variants #5007
Comments
Could you include a full reproduction case? Without access to |
Of course, I have made a minimal reproduction repository here. It's reproduced simply by running |
Examples of bad generated code: {
return :: std :: result :: Result ::
Ok(Self ::
List(< #[id(b"")] ListArgs as clap :: FromArgMatches > ::
from_arg_matches_mut(__clap_arg_matches) ?))
}
// ...
fn augment_subcommands < 'b > (__clap_app : clap :: Command) -> clap ::
Command
{
; let __clap_app = __clap_app ; let __clap_app =
__clap_app.subcommand({
let __clap_subcommand = clap :: Command :: new("list") ; let
__clap_subcommand = __clap_subcommand ; let __clap_subcommand =
{
< #[id(b"")] ListArgs as clap :: Args > ::
augment_args(__clap_subcommand)
} ; __clap_subcommand
}) ; ; __clap_app
} fn augment_subcommands_for_update < 'b > (__clap_app : clap :: Command)
-> clap :: Command
{
; let __clap_app = __clap_app ; let __clap_app =
__clap_app.subcommand({
let __clap_subcommand = clap :: Command :: new("list") ; let
__clap_subcommand = __clap_subcommand ; let __clap_subcommand =
{
< #[id(b"")] ListArgs as clap :: Args > ::
augment_args_for_update(__clap_subcommand)
} ; __clap_subcommand
}) ; ; __clap_app
// ... |
Well, thats annoying how easy it is to get this wrong but tests can only help with regressions; it would be hard to prevent future failures. Fixes clap-rs#5007
Thanks! That was a big help to see the exact reproduction case you were dealing with |
Of course! |
Please complete the following tasks
Rust Version
rustc 1.70.0 (90c541806 2023-05-31)
Clap Version
4.3.11
Minimal reproducible code
Where
ExternalDerive
is some derive macro that takesid
as an attribute. In a private project currently, so I can not point to a crate with this derive macro.Steps to reproduce the bug with the above code
cargo run list ~ 100
Actual Behaviour
Compilation fails due to the
Subcommand
derive macro.Expected Behaviour
I expect the code to compile, and to run, and then exit without doing anything.
Additional Context
No response
Debug Output
No response
The text was updated successfully, but these errors were encountered: