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

add_impl_generic doesn't work with new gen_impl #40

Open
RReverser opened this issue Mar 20, 2020 · 2 comments
Open

add_impl_generic doesn't work with new gen_impl #40

RReverser opened this issue Mar 20, 2020 · 2 comments

Comments

@RReverser
Copy link

For example, modying the current doctest on add_impl_generic to:

s.add_impl_generic(generic)
.gen_impl(quote! {
    gen impl krate::Trait<X> for @Self {
        fn a() {}
    }
})

generates:

#[allow(non_upper_case_globals)]
const _DERIVE_krate_Trait_X_FOR_A: () = {
    impl<T, U> krate::Trait<X> for A<T, U>
    where
        T: krate::Trait<X>,
        Option<U>: krate::Trait<X>,
        U: krate::Trait<X>,
    {
        fn a() {}
    }
};

As you can see, X is completely ignored in impl<...>.

My suggestion would be to either add support for generics produced by this method, or perhaps remove it altogether as part of #29 in favour of allowing gen impl<...> Trait for @Self ... syntax that would automatically merge impl params.

@RReverser
Copy link
Author

in favour of allowing gen impl<...> Trait for @self ... syntax that would automatically merge impl params

Actually, it seems this syntax is already allowed and covers my needs. But it still feels confusing that method is completely ignored - it should either be respected, produce an error, or be removed.

@nox
Copy link
Contributor

nox commented Nov 15, 2020

I have encountered this issue too. At least I have a work-around now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants