-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
Invalid BorrowDecode derive for a struct with a Cow<'a, [Foo]>
field
#631
Comments
Can you try the lifetimes that are used in this test? https://github.com/bincode-org/bincode/blob/trunk/tests/issues/issue_431.rs We should improve the ergonomics if this is the case |
Yes. Adding this line above FooList's definition fixes the issue:
But, it happens to be that the real #[derive(Debug, Decode, Encode)]
pub(crate) struct FooList(Cow<'static, [Foo]>); So a way to pass custom bounds in this case (or a way to skip the generation of |
It might be easier for you to manually implement decode. You can check
At the least I think bincode should properly document that anything involving |
Thanks for the suggestion. I actually already did that using good old I removed the Then I added the |
The situation of |
This fails due to the generated:
The error is obviously:
This is due to the assumption that all
Cow<'cow, T>
uses will have a T where&'cow T: BorrowDecode<'cow>
holds?!The text was updated successfully, but these errors were encountered: