paritytech / paritytech/parity-common
[rlp-derive] encode for Vec<Vec<T>> has type errors
Open
Nobody has claimed this yet.
F2-bug
- Dominant language
- Rust
- Stars
- 311
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the examples using the rlp_derive::RlpEncodable and RlpEncodableWrapper entry points, then trace the generated code reported at src/scrubbed.rs:64. Compare handling of nested Vec types and allocator parameters; done means both derive examples compile without the reported generic-argument errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100