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 regression in 1.0.38 #1223

Closed
dtolnay opened this issue Apr 21, 2018 · 1 comment
Closed

Type inference regression in 1.0.38 #1223

dtolnay opened this issue Apr 21, 2018 · 1 comment
Labels

Comments

@dtolnay
Copy link
Member

dtolnay commented Apr 21, 2018

The following compiles in 1.0.37 but is broken by #1213 in 1.0.38 because of rust-lang/rust#41617.

#[macro_use]
extern crate serde_derive;

extern crate serde;
use serde::de::DeserializeOwned;

trait Trait {
    type Associated;
}

#[derive(Deserialize)]
struct Struct<T: Trait> where T::Associated: DeserializeOwned {
    a: T::Associated,
}
@dtolnay dtolnay added the bug label Apr 21, 2018
@dtolnay
Copy link
Member Author

dtolnay commented May 5, 2018

The inference limitation here is unfortunate but I think we are better off sticking with the approach in #1213. In general data structures should not use DeserializeOwned as a trait bound anyway as discussed in the C-STRUCT-BOUNDS guideline.

@dtolnay dtolnay closed this as completed May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant