E0011: Malformed float literal
| Code | Category | Stability |
|---|---|---|
E0011 | Lexer | Permanent |
Explanation
A floating-point literal has a forbidden spelling: it begins with a decimal point, ends with one, or has an exponent marker without exponent digits.
Likely cause
The literal was written as .5, 5., 1e, or 1e+. Put a digit on both sides of a decimal point and provide at least one exponent digit, for example 0.5, 5.0, or 1e9.
Examples
Leading dot diagnosed by the lexer
fn main() {
let value = .5;
}
Trailing dot diagnosed by the parser
fn main() {
let value = 5.;
}