We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// [dependencies] // rand = "0.7" fn main() { use rand::seq::SliceRandom; let (x, y) = [(1, 2)].choose(&mut rand::thread_rng()).unwrap(); let x: i32 = x; }
x
let (x, y) = ...
The inferred type should be &i32. Alternatively, if we accept Chalk limitations or whatever this is, {unknown}.
&i32
{unknown}
The inferred type is i32. This makes the error in the next line confusing.
i32
By the way, the inferred type of y is {unknown}. Removing the next line turns the inferred type of x into {unknown} as well.
y
rust-analyzer version: 2020-05-25 (fbb8b88)
The text was updated successfully, but these errors were encountered:
Duplicate of #1165.
Inferring x as i32 is normal, the compiler does the same thing every time you write Vec::new().
Vec::new()
Sorry, something went wrong.
Type inference after type errors is best-effort; we infer x as i32 from the subsequent usage to still give you useful completions.
So yeah, I'd also consider this a duplicate.
No branches or pull requests
To reproduce
x
inlet (x, y) = ...
.Expected result
The inferred type should be
&i32
.Alternatively, if we accept Chalk limitations or whatever this is,
{unknown}
.Actual result
The inferred type is
i32
.This makes the error in the next line confusing.
By the way, the inferred type of
y
is{unknown}
.Removing the next line turns the inferred type of
x
into{unknown}
as well.The text was updated successfully, but these errors were encountered: