Skip to content
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

Infer trait bounds for generic derives #3032

Open
epage opened this issue Nov 16, 2021 · 0 comments
Open

Infer trait bounds for generic derives #3032

epage opened this issue Nov 16, 2021 · 0 comments
Labels
A-derive Area: #[derive]` macro API C-enhancement Category: Raise on the bar on expectations E-medium Call for participation: Experience needed to fix: Medium / intermediate

Comments

@epage
Copy link
Member

epage commented Nov 16, 2021

Building off of #2769 / #3023, we should allow inferring trait bounds.

So instead of

#[derive(Parser)]
struct Opt<T: Args> {
    #[clap(flatten)]
    inner: T,
}

The user does

#[derive(Parser)]
struct Opt<T> {
    #[clap(flatten)]
    inner: T,
}

like they do with when deriving Copy, Clone, serde types, etc.

See https://serde.rs/attr-bound.html for some inspiration on issues to deal with.

@epage epage added C-enhancement Category: Raise on the bar on expectations A-derive Area: #[derive]` macro API labels Nov 16, 2021
@epage epage mentioned this issue Nov 16, 2021
1 task
@epage epage added the E-medium Call for participation: Experience needed to fix: Medium / intermediate label Dec 13, 2021
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-enhancement Category: Raise on the bar on expectations E-medium Call for participation: Experience needed to fix: Medium / intermediate
Projects
None yet
Development

No branches or pull requests

1 participant