Replies: 2 comments
-
this error is fixed by polonius :( rust-lang/rust#125217 |
Beta Was this translation helpful? Give feedback.
0 replies
-
here is the workaround: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2fee0a2398b2eff2a24a6219a80113dc |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
here is a small clap program that does not compile: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b452d684735297330b56c4353ebbb98f
as far as i can tell, the problem is this: on each iteration of the loop, the lifetime returned by
find_subcommand_mut
shrinks in scope: it can't be live for previous iterations. but the compiler is trying to unify them all, and it gets mad that they don't match up.i am kind of surprised that no one has run into this before; i guess everyone has a fixed number of times they call
find_subcommand_mut
, they're not doing programatically? the only code example i found searching was #1350 (comment), which indeed does not use a loop (it calls the function twice in a row instead).is there some way to get this to work? my use case is that i want to add support for user-defined aliases by
*subcmd = subcmd.visible_alias(alias_name)
2 works ok; the trouble i'm having is with 1.
Beta Was this translation helpful? Give feedback.
All reactions