I got two functions:
fn foo() -> i32 {
let i;
i = 1;
i
}
(Rust Playground)
and
fn bar() -> (i32, i32) {
let i;
i.0 = 1;
i.1 = 2;
i
}
Rust compiler (1.48) complains about bar
that it needs type annotation for i
, but it's seems to be totally fine with no annotations for foo
.
Is it just a compiler imperfection or there is some reason why second case has no automatic type inference?