【发布时间】:2016-04-03 19:17:24
【问题描述】:
我多次使用了错误的语法,比如在这个例子中忘记使用let:
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); | ^^^^^^^^^
我知道这个问题是用let解决的,但是什么是“类型归属”,它有什么用呢?
我找到了issue #23416 和the feature gate for type ascription,但我不明白什么是“类型归属”或它的用途。
【问题讨论】:
标签: syntax rust ascription