Closed
Description
When writing floating point numbers, some people try to include the dot and and exponent notation. Rust sees this as a field access on an integral value. It should suggest adding a 0
after the dot.
Given the following code: Playpen
fn main() {
let n = 2.e1;
}
The current output is:
Compiling playground v0.0.1 (/playground)
error[[E0610]](https://doc.rust-lang.org/stable/error-index.html#E0610): `{integer}` is a primitive type and therefore doesn't have fields
--> src/main.rs:2:15
|
2 | let n = 2.e1;
| ^^
For more information about this error, try `rustc --explain E0610`.
error: could not compile `playground` due to previous error
Ideally the output should suggest adding a zero, like as follows:
Compiling playground v0.0.1 (/playground)
error[[E0610]](https://doc.rust-lang.org/stable/error-index.html#E0610): `{integer}` is a primitive type and therefore doesn't have fields
--> src/main.rs:2:15
|
2 | let n = 2.e1;
| ^^
For more information about this error, try `rustc --explain E0610`.
error: could not compile `playground` due to previous error
help: If the number is meant to be a floating point number, add a `0` after the period.
--> src/main.rs:2:15
|
2 | let n = 2.0e1;
| ^
It might also be good to squelch the E0610 message altogether too.