-
-
Notifications
You must be signed in to change notification settings - Fork 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
ArgAction::Count
type error not caught at compile time
#3864
Labels
A-derive
Area: #[derive]` macro API
C-bug
Category: Updating dependencies
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
Comments
epage
added
A-derive
Area: #[derive]` macro API
S-waiting-on-design
Status: Waiting on user-facing design to be resolved before implementing
E-easy
Call for participation: Experience needed to fix: Easy / not much
and removed
S-waiting-on-design
Status: Waiting on user-facing design to be resolved before implementing
labels
Jun 28, 2022
Thinking through this and the problems we normally have in moving an error to compile time, I think this is one case where we skip most of those. |
epage
added
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
E-help-wanted
Call for participation: Help is requested to fix this issue.
and removed
E-easy
Call for participation: Experience needed to fix: Easy / not much
labels
Jun 28, 2022
I think this is also an issue in the example on the args trait page. Currently it has: #[derive(clap::Parser)]
struct Args {
#[command(flatten)]
logging: LogArgs,
}
#[derive(clap::Args)]
struct LogArgs {
#[arg(long, short = 'v', action = clap::ArgAction::Count)]
verbose: i8,
} And I had something based on this that didn't work until I changed Edit: submitted #4610 to fix just this example |
tgross35
added a commit
to tgross35/clap
that referenced
this issue
Jan 7, 2023
tgross35
added a commit
to tgross35/clap
that referenced
this issue
Jan 7, 2023
epage
added a commit
that referenced
this issue
Jan 7, 2023
Fix example that as runtime panic. Relates to #3864
2 tasks
2 tasks
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-derive
Area: #[derive]` macro API
C-bug
Category: Updating dependencies
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Experience needed to fix: Medium / intermediate
Please complete the following tasks
Rust Version
rustc 1.61.0 (fe5b13d68 2022-05-18)
Clap Version
v3.2.6
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo build
and observe that the program builds.cargo run
and observe that the program panics at runtime due to a type error.Actual Behaviour
Type error causes a panic at runtime.
Expected Behaviour
Type error should be caught at compile time.
Alternatively, allow upcasting the
u8
into user`s preferred type automatically.The text was updated successfully, but these errors were encountered: