Compiling this on rustc 1.17.0-nightly (0648517fa 2017-02-03) gives me the following error.
error[E0277]: the trait bound `Test: serde::de::Deserialize` is not satisfied
--> src/main.rs:19:1
|
19 | #[post("/users", data = "<test>")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::de::Deserialize` is not implemented for `Test`
|
= note: required because of the requirements on the impl of `rocket::data::FromData` for `rocket_contrib::JSON<Test>`
Anyone that can spot what I am doing wrong? I am not able to figure it out
You could have different versions of serde, try installing cargo-tree (cargo install cargo-tree) then run cargo tree -i -p serde to see the inverted dependency tree of what versions of serde you have.
Yeh I think you'll have to downgrade serde from 0.9 to 0.8, it looks like that's what rocket_contrib expects.
That error is pretty unhelpful. Some cases where you get incompatible versions of the same type have been given a better message but it looks like that case isn't covered yet.
$ cargo tree -i -p serde
error: There are multiple `serde` packages in your project, and the specification `serde` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
serde:0.8.21
serde:0.9.6
And downgrading to 0.8.21 allowed me to compile. Can I report this anywhere, are there guidelines for how frameworks and libraries should handle this?