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

Type inference issue with IntoDeserializer #1967

Closed
ehuss opened this issue Jan 25, 2021 · 0 comments
Closed

Type inference issue with IntoDeserializer #1967

ehuss opened this issue Jan 25, 2021 · 0 comments

Comments

@ehuss
Copy link

ehuss commented Jan 25, 2021

With the release of 1.122, IntoDeserializer seems to have type inference problems with strings. For example:

use serde::de::IntoDeserializer;

fn f<'a, T: IntoDeserializer<'a>>(t: T) {
    t.into_deserializer();
}

fn main() {
    let s = String::new();
    f(s.as_ref());  // ERROR: type annotation needed
}

The real-world example is in Cargo as illustrated here: rust-lang/cargo#9101

This seems to be caused by #1898. cc @Mingun

I'm fine if this is closed as WontFix (I can easily add a type annotation), I just wanted to check if this was intended or ok.

EDIT: Updated code to avoid issue in rust-lang/cargo#9102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants