error: missing type for `const` item
error: missing type for `static` item
const
または static
のアイテムで型推論を使おうとした。
『型推論の未対応箇所』によると、const
や static
のアイテムでは型推論が使えない。
そのため、型を指定しないとエラーになる。
pub const VAL = 1_i32;
error: missing type for `const` item --> src\lib.rs:1:14 | 1 | pub const VAL = 1_i32; | ^ help: provide a type for the constant: `: i32`
以下のように型を明示するとよい。
pub const VAL: i32 = 1_i32;