Error when trying to delegate a trait with multiple generics
CJKay opened this issue · 1 comments
CJKay commented
Hi folks, I'm having some trouble getting a trait with multiple generic type arguments to delegate. I couldn't find this in either the test or any of the examples, so I'm just wondering whether this is an undocumented limitation.
This works fine:
#[delegatable_trait]
pub trait Target<T> {}
pub struct SubTarget;
impl<T> Target<T> for SubTarget {}
#[derive(Delegate)]
#[delegate(Target<T>, generics = "T")]
pub struct SuperTarget(SubTarget);
This, on the other hand:
#[delegatable_trait]
pub trait Target<T, U> {}
pub struct SubTarget;
impl<T, U> Target<T, U> for SubTarget {}
#[derive(Delegate)]
#[delegate(Target<T, U>, generics = "T, U")]
pub struct SuperTarget(SubTarget);
Throws this error:
error: proc-macro derive panicked
--> ...
|
1 | #[derive(Delegate)]
| ^^^^^^^^
|
= help: message: expected `,`
xis19 commented
I am seeing a similar issue when I tried to delegate std::ops::Index<usize, Output=T>