Several times I've used the wrong syntax, such as forgetting to use let
in this example:
let closure_annotated = |value: i32| -> i32 {
temp: i32 = fun(5i32);
temp + value + 1
};
error[E0658]: type ascription is experimental (see issue #23416) --> src/main.rs:3:9 | 3 | temp: i32 = fun(5i32); | ^^^^^^^^^
I know that this problem is solved by using let
, but what is "type ascription" and what is its use?
I found issue #23416 and the feature gate for type ascription, but I could not understand what "type ascription" is or what is its purpose.