-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Cannot infer type for [], but only when serde_json is used (?) #89254
Comments
Looks like the problem is So I suppose this is expected, although very confusing. Here's a reproduction without a dependency: struct Shark;
impl PartialEq<Shark> for u8 {
fn eq(&self, other: &Shark) -> bool {
false
}
}
fn main() {
Vec::<u8>::new() == [];
} Labeling this as a diagnostics issue. |
Of course having better diagnostics here is best for the immediate future, but has it ever been considered to have a "preferred" implementation where |
For the general diagnostic improvement, we should be pointing at all the |
…=jackh726 Point at overlapping impls when type annotations are needed Address rust-lang#89254.
Current output:
I think the diagnostics part of this is handled relatively ok. Tagging t-lang for the "priority impl" feature suggestion. |
That produces:
Somehow, referencing
serde_json
makes rustc unable to infer some type here. This happens on both the current stable and nightly versions of Rust.The text was updated successfully, but these errors were encountered: