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

Token does not implement serde::de::Deserialize #22

Closed
squidpickles opened this issue Apr 20, 2016 · 8 comments
Closed

Token does not implement serde::de::Deserialize #22

squidpickles opened this issue Apr 20, 2016 · 8 comments
Assignees
Labels

Comments

@squidpickles
Copy link

... except that it does appear to...
In common.rs, I can see Deserialize inside the #derive attribute. But, this extremely simple sample code does not compile:

extern crate yup_oauth2;
extern crate serde_json;
use yup_oauth2::Token;

fn main() {
    serde_json::from_str::<Token>("");
}
src/main.rs:6:5: 6:34 error: the trait `serde::de::Deserialize` is not implemented for the type `yup_oauth2::common::Token` [E0277]
src/main.rs:6     serde_json::from_str::<Token>("");
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.rs:6:5: 6:34 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:6:5: 6:34 note: required by `serde_json::de::from_str`

Am I missing something obvious here?

@Byron Byron self-assigned this Apr 23, 2016
@Byron Byron added this to the 1.0.0 milestone Apr 23, 2016
@Byron
Copy link
Collaborator

Byron commented Apr 23, 2016

Actually I am having serious trouble compiling it myself. The only project that manages to compile it is google-apis-rs right now. Maybe the author of #19 can help with that too !

@Byron Byron added the bug label Apr 24, 2016
@Byron
Copy link
Collaborator

Byron commented Apr 24, 2016

Maybe related to #23 .

@dermesser
Copy link
Owner

Looking, I got the very same error. I'll try to reproduce.

@dermesser
Copy link
Owner

@squidpickles Which version of serde_json are you using? yup-oauth2 is using 0.6.0, and if you use any other version than that, then there's an invisible type mismatch.

you could rewrite the compiler error as e.g.

error: the trait serde::de::Deserialize@serde_json-0.7.0 is not implemented for the type `yup_oauth2::common::Token` [E0277]

...although it implements serde::de::Deserialize@serde_json-0.6.0.

Try pinning your serde_json version to 0.6.0.

see also https://internals.rust-lang.org/t/dependency-hell-resolving-conflicting-version-requirements/1675. It's a similarly staggering error, but caused by different versions of one crate:

src/main.rs:513:9: 513:21 error: mismatched types:
 expected `rustc-serialize::json::Json`,
    found `rustc-serialize::json::Json`

@squidpickles
Copy link
Author

@dermesser That's possibly what was happening.

I took a snapshot of all of the versions that were around the last time this compiled successfully.
The dependencies in my Cargo.toml look like this:

hyper = "0.7.2"
serde = "0.6.7"
serde_json = "0.6.0"
google-calendar3 = "0.1.10"
yup-oauth2 = "0.5.3"
time = "0.1.34"

(I notice it's not quite sticking to my desired versions. Is there a way to force maximum versions from the top level Cargo.toml?)

But, with those versions pinned, I get a new set of errors. The first:

target/debug/build/yup-oauth2-261d9a0a2c806055/out/lib.rs:189:17: 189:43 error: unresolved name `form_urlencoded::serialize` [E0425]
target/debug/build/yup-oauth2-261d9a0a2c806055/out/lib.rs:189                 form_urlencoded::serialize(&[("client_id", client_id),
                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
.multirust/toolchains/stable/cargo/registry/src/github.com-88ac128001ac3a9a/yup-oauth2-0.5.6/src/lib.rs:71:1: 71:47 note: in this expansion of include!
target/debug/build/yup-oauth2-261d9a0a2c806055/out/lib.rs:189:17: 189:43 help: run `rustc --explain E0425` to see a detailed explanation

@squidpickles
Copy link
Author

My code does compile with this attached Cargo.lock. Maybe I can incrementally upgrade packages until I find the break...

@dermesser
Copy link
Owner

dermesser commented Apr 27, 2016

See PR 24 (issue #23) for the form_urlencoded... error

@Byron
Copy link
Collaborator

Byron commented May 20, 2016

This should now be fixed with release 0.6.0. I am planning to upgrade the URL crate soon as well, in case that matters.

@Byron Byron closed this as completed May 20, 2016
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

3 participants