Closed
Description
This code: (Playground Link)
fn main() {
let x: f64 = 6.674e−11;
}
Looks pretty identical to this code:
fn main() {
let x: f64 = 6.674e-11;
}
But the first one doesn't compile because I accidentally used a unicode minus sign (−) instead of a dash (-). This happened to me when I pasted a constant from Wikipedia.
error: expected at least one digit in exponent
--> src/main.rs:2:24
|
2 | let x: f64 = 6.674e−11;
| ^
We already produce an error about things like this in other cases. For example with an en space:
fn main() {
let a = ();
}
We produce the following:
error: unknown start of token: \u{2002}
--> src/main.rs:2:8
|
2 | let a = ();
| ^
|
help: unicode character ' ' (En Space) looks like ' ' (Space), but it's not
--> src/main.rs:2:8
|
2 | let a = ();
| ^
error: Could not compile `playground`.
Maybe we could do the same for the minus sign since it is a pretty confusing error to receive?