Suggest adding a missing zero to a floating point number#98972
Conversation
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
I will also implement this suggestion for the following case later. fn main() {
3.e1f32;
} |
| ) | ||
| .emit(); | ||
| ); | ||
| if expr_t.is_integral() |
There was a problem hiding this comment.
Is it possible for you to check that the type we're dereferencing with . is a numerical literal? Specifically, I don't want it to fix:
let x = 1i32;
x.e10;
There was a problem hiding this comment.
Or if it already accounts for this, can you add a ui test for this case?
There was a problem hiding this comment.
To elaborate on this, I would probably just span_to_snippet and check that it parses as a valid number, to account for macro expansions. So you should also add a check for:
macro_rules! num { () => { 1 } }
fn main() {
num!().e10;
}
|
Thanks for the thorough test cases, when I am at my computer I will double check the implementation but it looks great. |
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
e60c9a5 to
e03cb7f
Compare
|
r=me after CI turns green, since i am sleeping soon @bors delegate+ |
|
✌️ @TaKO8Ki can now approve this pull request |
|
@bors r=compiler-errors |
…-to-floating-point-number, r=compiler-errors Suggest adding a missing zero to a floating point number fixes rust-lang#98836
…-to-floating-point-number, r=compiler-errors Suggest adding a missing zero to a floating point number fixes rust-lang#98836
Rollup of 6 pull requests Successful merges: - rust-lang#98622 (rustc_target: Flip the default for `TargetOptions::executables` to true) - rust-lang#98633 (Fix last `let_chains` blocker) - rust-lang#98972 (Suggest adding a missing zero to a floating point number) - rust-lang#99038 (Some more `EarlyBinder` cleanups) - rust-lang#99154 (use PlaceRef::iter_projections to fix old FIXME) - rust-lang#99171 (Put back UI test regex) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
fixes #98836