Semi-complex arg! macro invocation causes stack overflow and huge slowdown with build, check, or clippy #4670
Closed
2 tasks done
Labels
C-bug
Category: Updating dependencies
Please complete the following tasks
Rust Version
rustc 1.66.1 (90743e729 2023-01-10)
Clap Version
4.1.3
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo check
Actual Behaviour
The check command takes an unreasonably long amount of time to complete (around 10 seconds on my machine for the repro code alone).
cargo build
andcargo clippy
similarly take an unreasonably long time to complete.When running, the program overflows the stack.
Expected Behaviour
The check command should complete in a very short amount of time (less than one second).
cargo build
andcargo clippy
should take a relatively short time as well.When running, the program should execute to completion.
Additional Context
It seems like the combination of a three-word option name, num_args/value_names and multiple values (
...
) is relevant. The following examples all take a more reasonable amount of time:I have worked around the problem by building the Arg struct manually. However this makes the
arg!
macro unusable for me - the editor experience is destroyed because with checking slowed down so much, even syntax higlighting is broken.Debug Output
thread 'main' has overflowed its stack
The text was updated successfully, but these errors were encountered: