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

[rlp-derive] encode for Vec<Vec<T>> has type errors #604

Open
skylerqpq opened this issue Nov 30, 2021 · 0 comments
Open

[rlp-derive] encode for Vec<Vec<T>> has type errors #604

skylerqpq opened this issue Nov 30, 2021 · 0 comments
Labels

Comments

@skylerqpq
Copy link

repro example

#[derive(rlp_derive::RlpEncodable)]
struct DoubleVec {
    data: Vec<Vec<u8>>,
}

// Just to note that this also fails.
#[derive(rlp_derive::RlpEncodableWrapper)]
struct DoubleVec2 {
    data: Vec<Vec<u8>>,
}

Expected outcome

This compiles

Actual result

error[E0107]: missing generics for struct `Vec`
   --> src/scrubbed.rs:Line:Column
    |
64  |     data: Vec<Vec<u8>>,
    |               ^^^ expected at least 1 generic argument
    |
note: struct defined here, with at least 1 generic parameter: `T`
   --> /Users/sross/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:398:12
    |
398 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |            ^^^ -
help: add missing generic argument
    |
64  |     data: Vec<Vec<T><u8>>,
    |               ~~~~~~

Additionally, the assumption in the derive code about Vec only having one type parameter is false (the allocator API adds a second type param A)

@skylerqpq skylerqpq changed the title [rlp-derive] encode for Double Vec has type errors [rlp-derive] encode for Vec<Vec<T>> has type errors Nov 30, 2021
@ordian ordian added the F2-bug label Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants