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

derive(Deserialize) panics with index out of bounds for #[serde(skip)] #1804

Closed
matklad opened this issue May 8, 2020 · 1 comment · Fixed by #1805
Closed

derive(Deserialize) panics with index out of bounds for #[serde(skip)] #1804

matklad opened this issue May 8, 2020 · 1 comment · Fixed by #1805

Comments

@matklad
Copy link

matklad commented May 8, 2020

Observed in this commit

matklad/cargo_metadata@0b1c8d8

   Compiling cargo_metadata v0.9.1 (/home/matklad/projects/cargo_metadata)
error: proc-macro derive panicked
  --> src/messages.rs:99:35
   |
99 | #[derive(Debug, Clone, Serialize, Deserialize)]
   |                                   ^^^^^^^^^^^
   |
   = help: message: index out of bounds: the len is 5 but the index is 5

error: aborting due to previous error

error: could not compile `cargo_metadata`.

I think I am doing something very stupid with this skip, which is a bug in my code, but I think serde still should not panic, but rather explain me that I am holding it wrong?

serde_derive version = "1.0.106"

@dtolnay
Copy link
Member

dtolnay commented May 8, 2020

This was a bug; what you are doing should work. Fixed in 1.0.107.

Fabian-Gruenbichler added a commit to Fabian-Gruenbichler/cargo_metadata that referenced this issue Jul 30, 2020
as older versions can't compile cargo_metadata because of serde-rs/serde#1804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants