-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest a float literal when dividing a floating-point type by {integer}
#94078
Suggest a float literal when dividing a floating-point type by {integer}
#94078
Conversation
r? @scottmcm (rust-highfive has picked a reviewer for you, use r? to override) |
{integer}
This seems reasonable to do for the other arithmetic operators as well. |
@TaKO8Ki Do you want to try to take on the change to make this an in-the-compiler suggestion with a structured fix, as @joshtriplett mentions? Or would you rather check this in as a quick improvement and leave the fancier suggestion to someone later? |
@scottmcm I am going to take on it and I think I can do it myself! |
3ab9a90
to
2078608
Compare
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
I'm not a compiler reviewer, so I'll re-roll someone who actually know how these things are done: r? rust-lang/diagnostics |
This comment has been minimized.
This comment has been minimized.
8ed46d9
to
24b200c
Compare
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
552bd32
to
5511c50
Compare
This comment has been minimized.
This comment has been minimized.
5511c50
to
758d55c
Compare
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
The new approach is much cleaner! I have only one nitpick around code duplication, but once we've addressed that I'm ready for merging. |
Awesome! One last thing, could you squash your commits? |
aec2413
to
d151d07
Compare
@estebank |
@bors r+ |
📌 Commit d151d07 has been approved by |
…loat-divided-by-integer, r=estebank Suggest a float literal when dividing a floating-point type by `{integer}` closes rust-lang#93829
Hmm, might need a rebase after #93368 (see #94367 (comment) ) |
…loat-divided-by-integer, r=estebank Suggest a float literal when dividing a floating-point type by `{integer}` closes rust-lang#93829
fix a message implement a rustfix-applicable suggestion implement `suggest_floating_point_literal` add `ObligationCauseCode::BinOp` remove duplicate code fix function names in uitests use `Diagnostic` instead of `DiagnosticBuilder`
d151d07
to
c60bae7
Compare
I solved this problem. Could you please review it again? @estebank ref: #94078 (comment) |
@bors r+ |
📌 Commit c60bae7 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (8c9640e): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
closes #93829